org.eclipse.mat.internal.snapshot
Class SnapshotQueryContext

java.lang.Object
  extended by org.eclipse.mat.query.registry.QueryContextImpl
      extended by org.eclipse.mat.internal.snapshot.SnapshotQueryContext
All Implemented Interfaces:
IQueryContext

public class SnapshotQueryContext
extends QueryContextImpl


Constructor Summary
SnapshotQueryContext(ISnapshot snapshot)
           
 
Method Summary
 boolean available(java.lang.Class<?> type, Argument.Advice advice)
          Is this type of data available from the context?
 boolean converts(java.lang.Class<?> type, Argument.Advice advice)
          Does the context have a converter for data of this type?
 java.lang.String convertToString(java.lang.Class<?> type, Argument.Advice advice, java.lang.Object value)
          Convert the value to a string.
 java.lang.Object convertToValue(java.lang.Class<?> type, Argument.Advice advice, java.lang.String value)
          Convert the String to the value based on the type and advice.
 java.lang.Object get(java.lang.Class<?> type, Argument.Advice advice)
          Get this type of data from the context.
 ContextDerivedData getContextDerivedData()
          For example, retained size derived data.
 java.io.File getPrimaryFile()
          The main file for the snapshot
 java.lang.String mapToExternalIdentifier(int objectId)
          Map an id to a readable form.
 int mapToObjectId(java.lang.String externalIdentifier)
          Map readable form to internal id.
 java.lang.Object parse(java.lang.Class<?> type, Argument.Advice advice, java.lang.String[] args, java.text.ParsePosition pos)
          Consume the special data.
 boolean parses(java.lang.Class<?> type, Argument.Advice advice)
          Is special parsing required to get an object of the required type?
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnapshotQueryContext

public SnapshotQueryContext(ISnapshot snapshot)
Method Detail

getPrimaryFile

public java.io.File getPrimaryFile()
Description copied from interface: IQueryContext
The main file for the snapshot

Returns:
the dump

mapToExternalIdentifier

public java.lang.String mapToExternalIdentifier(int objectId)
                                         throws SnapshotException
Description copied from interface: IQueryContext
Map an id to a readable form. Reverse of IQueryContext.mapToObjectId(java.lang.String)

Returns:
readable external version
Throws:
SnapshotException
See Also:
IQueryContext.mapToObjectId(java.lang.String)

mapToObjectId

public int mapToObjectId(java.lang.String externalIdentifier)
                  throws SnapshotException
Description copied from interface: IQueryContext
Map readable form to internal id. Reverse of IQueryContext.mapToExternalIdentifier(int)

Returns:
the object id
Throws:
SnapshotException

available

public boolean available(java.lang.Class<?> type,
                         Argument.Advice advice)
Description copied from interface: IQueryContext
Is this type of data available from the context?

Specified by:
available in interface IQueryContext
Overrides:
available in class QueryContextImpl
Parameters:
type - the type the data should be converted to
advice - advice such as from the query as to how the value should be converted.
Returns:
true if available.

get

public java.lang.Object get(java.lang.Class<?> type,
                            Argument.Advice advice)
Description copied from interface: IQueryContext
Get this type of data from the context.

Specified by:
get in interface IQueryContext
Overrides:
get in class QueryContextImpl
Parameters:
type - the type the data should be converted to
advice - advice such as from the query as to how the value should be converted.
Returns:
the object of the right type

converts

public boolean converts(java.lang.Class<?> type,
                        Argument.Advice advice)
Description copied from interface: IQueryContext
Does the context have a converter for data of this type?

Specified by:
converts in interface IQueryContext
Overrides:
converts in class QueryContextImpl
Returns:
true if available and convertible

convertToString

public java.lang.String convertToString(java.lang.Class<?> type,
                                        Argument.Advice advice,
                                        java.lang.Object value)
                                 throws SnapshotException
Description copied from interface: IQueryContext
Convert the value to a string. For example the converter might be String.valueOf(Integer)

Specified by:
convertToString in interface IQueryContext
Overrides:
convertToString in class QueryContextImpl
Returns:
the value converted to a String
Throws:
SnapshotException

convertToValue

public java.lang.Object convertToValue(java.lang.Class<?> type,
                                       Argument.Advice advice,
                                       java.lang.String value)
                                throws SnapshotException
Description copied from interface: IQueryContext
Convert the String to the value based on the type and advice.

Specified by:
convertToValue in interface IQueryContext
Overrides:
convertToValue in class QueryContextImpl
Returns:
the String converted to a value
Throws:
SnapshotException

parses

public boolean parses(java.lang.Class<?> type,
                      Argument.Advice advice)
Description copied from interface: IQueryContext
Is special parsing required to get an object of the required type?

Returns:
true if parsing is needed.

parse

public java.lang.Object parse(java.lang.Class<?> type,
                              Argument.Advice advice,
                              java.lang.String[] args,
                              java.text.ParsePosition pos)
                       throws SnapshotException
Description copied from interface: IQueryContext
Consume the special data. For example using the ArgumentParser for data from a query wizard.

Returns:
the result of parsing the data suitable given the type and advice
Throws:
SnapshotException

getContextDerivedData

public ContextDerivedData getContextDerivedData()
Description copied from interface: IQueryContext
For example, retained size derived data.

Returns:
the derived data