Package org.eclipse.mat.snapshot.query
Class SnapshotQuery
- java.lang.Object
-
- org.eclipse.mat.snapshot.query.SnapshotQuery
-
public class SnapshotQuery extends java.lang.Object
This class provides possibility to lookup, inspect, parameterize and execute queries on a given heap dump.NOTE: The queries delivered with Memory Analyzer and their expected parameters are not part of the API. Both names/identifiers and parameters may change.
Usage example:IResult result = SnapshotQuery.lookup("top_consumers_html", snapshot) // .setArgument("objects", retained) // .execute(listener);
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description IResult
execute(IProgressListener listener)
Execute the query and return the result.java.util.List<? extends IArgumentDescriptor>
getArguments()
Get the list of the query arguments.IAnnotatedObjectDescriptor
getDescriptor()
Get a descriptor for the query.static SnapshotQuery
lookup(java.lang.String name, ISnapshot snapshot)
Factory method to create a query by name.static SnapshotQuery
parse(java.lang.String commandLine, ISnapshot snapshot)
Factory method to create a query by command line, i.e.RefinedResultBuilder
refine(IProgressListener listener)
Execute the query and return aRefinedResultBuilder
which allows for filtering, sorting and limiting of the result.SnapshotQuery
set(java.lang.String name, java.lang.Object value)
Deprecated.use setArgument() insteadSnapshotQuery
setArgument(java.lang.String name, java.lang.Object value)
Set the argument identified byname
.
-
-
-
Method Detail
-
lookup
public static SnapshotQuery lookup(java.lang.String name, ISnapshot snapshot) throws SnapshotException
Factory method to create a query by name.- Throws:
SnapshotException
-
parse
public static SnapshotQuery parse(java.lang.String commandLine, ISnapshot snapshot) throws SnapshotException
Factory method to create a query by command line, i.e. setting the arguments accordingly.- Throws:
SnapshotException
-
getDescriptor
public IAnnotatedObjectDescriptor getDescriptor()
Get a descriptor for the query. From it one can inspect the Name, Help, Icon, etc... for the query.- Returns:
IAnnotatedObjectDescriptor
a descriptor for the query- Since:
- 1.0
-
getArguments
public java.util.List<? extends IArgumentDescriptor> getArguments()
Get the list of the query arguments.- Returns:
- the list of
IArgumentDescriptor
describing the arguments which the query expects - Since:
- 1.0
-
setArgument
public SnapshotQuery setArgument(java.lang.String name, java.lang.Object value) throws SnapshotException
Set the argument identified byname
. Heap objects can be provided asint
,Integer
,int[]
orIObject
.- Parameters:
name
- the name of the argumentvalue
- the new value of the argument- Returns:
- the modified SnapshotQuery object
- Throws:
SnapshotException
- Since:
- 1.0
-
set
public SnapshotQuery set(java.lang.String name, java.lang.Object value) throws SnapshotException
Deprecated.use setArgument() instead- Throws:
SnapshotException
-
execute
public IResult execute(IProgressListener listener) throws SnapshotException
Execute the query and return the result.- Throws:
SnapshotException
-
refine
public RefinedResultBuilder refine(IProgressListener listener) throws SnapshotException
Execute the query and return aRefinedResultBuilder
which allows for filtering, sorting and limiting of the result.- Throws:
SnapshotException
-
-