Package org.eclipse.mat.query.registry
Class QueryContextImpl
- java.lang.Object
-
- org.eclipse.mat.query.registry.QueryContextImpl
-
- All Implemented Interfaces:
IQueryContext
- Direct Known Subclasses:
ProviderContextImpl,SnapshotQueryContext
public abstract class QueryContextImpl extends java.lang.Object implements IQueryContext
-
-
Constructor Summary
Constructors Constructor Description QueryContextImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanavailable(java.lang.Class<?> type, Argument.Advice advice)Is this type of data available from the context?booleanconverts(java.lang.Class<?> type, Argument.Advice advice)Does the context have a converter for data of this type?java.lang.StringconvertToString(java.lang.Class<?> type, Argument.Advice advice, java.lang.Object value)Convert the value to a string.java.lang.ObjectconvertToValue(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.Objectget(java.lang.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
-
-
-
-
Method Detail
-
available
public boolean available(java.lang.Class<?> type, Argument.Advice advice)Description copied from interface:IQueryContextIs this type of data available from the context?- Specified by:
availablein interfaceIQueryContext- Parameters:
type- the type the data should be converted toadvice- 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:IQueryContextGet this type of data from the context.- Specified by:
getin interfaceIQueryContext- Parameters:
type- the type the data should be converted toadvice- 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:IQueryContextDoes the context have a converter for data of this type?- Specified by:
convertsin interfaceIQueryContext- Parameters:
type- The Java type of an argument to be supplied with data from this context.advice- Further details about the argument to be supplied with data.- Returns:
- true if available and convertible
-
convertToString
public java.lang.String convertToString(java.lang.Class<?> type, Argument.Advice advice, java.lang.Object value) throws SnapshotExceptionDescription copied from interface:IQueryContextConvert the value to a string. For example the converter might be String.valueOf(Integer)- Specified by:
convertToStringin interfaceIQueryContext- Parameters:
type- The Java type of the argument.advice- Further details about the argument.value- The value of the argument held in the context.- Returns:
- the value converted to a String
- Throws:
SnapshotException- If there is a problem with the conversion such as the value is not a valid object ID.
-
convertToValue
public java.lang.Object convertToValue(java.lang.Class<?> type, Argument.Advice advice, java.lang.String value) throws SnapshotExceptionDescription copied from interface:IQueryContextConvert the String to the value based on the type and advice.- Specified by:
convertToValuein interfaceIQueryContext- Parameters:
type- The Java type of the argumentadvice- Further details about the argument.value- The readable string value- Returns:
- the String converted to a value suitable to be stored in the argument.
- Throws:
SnapshotException- if there is a problem with the conversion, such as an unknown object address.
-
-