org.eclipse.mat.query
Interface IQueryContext

All Known Implementing Classes:
ProviderContextImpl, QueryContextImpl, SnapshotQueryContext

public interface IQueryContext

The context for a query. Hides the snapshot implementation, and is not tied to the snapshot API.

No Implement:

Method Summary
 boolean available(Class<?> type, Argument.Advice advice)
          Is this type of data available from the context?
 boolean converts(Class<?> type, Argument.Advice advice)
          Does the context have a converter for data of this type?
 String convertToString(Class<?> type, Argument.Advice advice, Object value)
          Convert the value to a string.
 Object convertToValue(Class<?> type, Argument.Advice advice, String value)
          Convert the String to the value based on the type and advice.
 Object get(Class<?> type, Argument.Advice advice)
          Get this type of data from the context.
 ContextDerivedData getContextDerivedData()
          For example, retained size derived data.
 String getPrefix()
          The prefix for files generated from snapshot
 File getPrimaryFile()
          The main file for the snapshot
 String mapToExternalIdentifier(int objectId)
          Map an id to a readable form.
 int mapToObjectId(String externalIdentifier)
          Map readable form to internal id.
 Object parse(Class<?> type, Argument.Advice advice, String[] args, ParsePosition pos)
          Consume the special data.
 boolean parses(Class<?> type, Argument.Advice advice)
          Is special parsing required to get an object of the required type?
 

Method Detail

getPrimaryFile

File getPrimaryFile()
The main file for the snapshot

Returns:
the dump

getPrefix

String getPrefix()
The prefix for files generated from snapshot

Returns:
the prefix
Since:
1.3

available

boolean available(Class<?> type,
                  Argument.Advice advice)
Is this type of data available from the context?

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

Object get(Class<?> type,
           Argument.Advice advice)
Get this type of data from the context.

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

mapToExternalIdentifier

String mapToExternalIdentifier(int objectId)
                               throws SnapshotException
Map an id to a readable form. Reverse of mapToObjectId(java.lang.String)

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

mapToObjectId

int mapToObjectId(String externalIdentifier)
                  throws SnapshotException
Map readable form to internal id. Reverse of mapToExternalIdentifier(int)

Parameters:
externalIdentifier -
Returns:
the object id
Throws:
SnapshotException

converts

boolean converts(Class<?> type,
                 Argument.Advice advice)
Does the context have a converter for data of this type?

Parameters:
type -
advice -
Returns:
true if available and convertible

convertToString

String convertToString(Class<?> type,
                       Argument.Advice advice,
                       Object value)
                       throws SnapshotException
Convert the value to a string. For example the converter might be String.valueOf(Integer)

Parameters:
type -
advice -
value -
Returns:
the value converted to a String
Throws:
SnapshotException

convertToValue

Object convertToValue(Class<?> type,
                      Argument.Advice advice,
                      String value)
                      throws SnapshotException
Convert the String to the value based on the type and advice.

Parameters:
type -
advice -
value -
Returns:
the String converted to a value
Throws:
SnapshotException

parses

boolean parses(Class<?> type,
               Argument.Advice advice)
Is special parsing required to get an object of the required type?

Parameters:
type -
advice -
Returns:
true if parsing is needed.

parse

Object parse(Class<?> type,
             Argument.Advice advice,
             String[] args,
             ParsePosition pos)
             throws SnapshotException
Consume the special data. For example using the ArgumentParser for data from a query wizard.

Parameters:
type -
advice -
args -
pos -
Returns:
the result of parsing the data suitable given the type and advice
Throws:
SnapshotException

getContextDerivedData

ContextDerivedData getContextDerivedData()
For example, retained size derived data.

Returns:
the derived data