org.eclipse.mat.query.registry
Class QueryContextImpl

java.lang.Object
  extended by org.eclipse.mat.query.registry.QueryContextImpl
All Implemented Interfaces:
IQueryContext
Direct Known Subclasses:
ProviderContextImpl, SnapshotQueryContext

public abstract class QueryContextImpl
extends Object
implements IQueryContext


Constructor Summary
QueryContextImpl()
           
 
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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.mat.query.IQueryContext
getContextDerivedData, getPrefix, getPrimaryFile, mapToExternalIdentifier, mapToObjectId, parse, parses
 

Constructor Detail

QueryContextImpl

public QueryContextImpl()
Method Detail

available

public boolean available(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
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 Object get(Class<?> type,
                  Argument.Advice advice)
Description copied from interface: IQueryContext
Get this type of data from the context.

Specified by:
get in interface IQueryContext
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(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
Returns:
true if available and convertible

convertToString

public String convertToString(Class<?> type,
                              Argument.Advice advice,
                              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
Returns:
the value converted to a String
Throws:
SnapshotException

convertToValue

public Object convertToValue(Class<?> type,
                             Argument.Advice advice,
                             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
Returns:
the String converted to a value
Throws:
SnapshotException