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 Object implements IQueryContext
  • Constructor Details

    • QueryContextImpl

      public QueryContextImpl()
  • Method Details

    • 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
      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 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
      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 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
      Parameters:
      type - The Java type of the argument
      advice - 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.