Query

org.eclipse.mat.api.query

0.7.0

The Memory Analyzer can be extended by Queries. Queries are pieces of Java Code that implement specific inspections on the heap dump. Depending on the input parameters, queries are shown in the Query Drop-Down menu and/or in the context menu of a heap object.

<!ELEMENT extension (query)+>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT query EMPTY>

<!ATTLIST query

impl CDATA #REQUIRED>


Following is an example of a query declaration:

   

<extension point=

"org.eclipse.mat.report.query"

>

<query impl=

"org.eclipse.mat.demo.DemoQuery"

/>

</extension>

The value of the impl attribute must represent an implementor of org.eclipse.mat.query.IQuery. The public fields in the query can be tagged with the @Argument annotation so they can be filled in by the query wizard. Argument types include
ISnapshot
the snapshot
IHeapObjectArgument
one or more objects
int
a single object
boolean
a flag
Queries can be tagged with @Name @Help @HelpURL @Icon @Menu @Category @CommandName. These annotations can also be held in an annotations.properties file for ease of translation.

The Memory Analyzer supplies a number of queries itself. Check out the org.eclipse.mat.inspections package for more samples.