Package org.eclipse.mat.snapshot

# Class OQL

java.lang.Object
org.eclipse.mat.snapshot.OQL

public final class OQL extends Object
Factory for often-used OQL queries.

## Method Summary

Modifier and Type
Method
Description
`static String`
`classesByClassLoaderId(int classLoaderId)`
Returns an OQL query string to select all classes loaded by the given class loader.
`static String`
`classesByPattern(Pattern pattern, boolean includeSubclasses)`
Returns all classes matching a given regular expression.
`static final String`
`forAddress(long address)`
Select object by its address.
`static final String`
`forObjectId(int objectId)`
Select object by its object id.
`static String`
`forObjectIds(int[] objectIds)`
Select objects by its ids.
`static final String`
`forObjectsOfClass(int classId)`
All objects of a class identified by its id.
`static final String`
`forObjectsOfClass(IClass clasz)`
All objects of a given class.
`static String`
`instancesByClassLoaderId(int classLoaderId)`
Returns an OQL query string to select all objects loaded by the given class loader.
`static String`
`instancesByPattern(Pattern pattern, boolean includeSubclasses)`
Return all instances of classes matching a given regular expression.
`static String`
`retainedBy(int objectId)`
Select the retained set of a given object.
`static final String`
`retainedBy(String oqlQuery)`
Select the retained set of a given OQL query.
`static void`
`union(StringBuilder query, String other)`
Create a OQL union statement and append it to the query.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### forAddress

public static final String forAddress(long address)
Select object by its address.

### forObjectId

public static final String forObjectId(int objectId)
Select object by its object id.

### forObjectIds

public static String forObjectIds(int[] objectIds)
Select objects by its ids.

### retainedBy

public static final String retainedBy(String oqlQuery)
Select the retained set of a given OQL query.

### retainedBy

public static String retainedBy(int objectId)
Select the retained set of a given object.

### forObjectsOfClass

public static final String forObjectsOfClass(IClass clasz)
All objects of a given class.

### forObjectsOfClass

public static final String forObjectsOfClass(int classId)
All objects of a class identified by its id.

### union

public static void union(StringBuilder query, String other)
Create a OQL union statement and append it to the query. Possibly optimize a common prefix. select s.a,s.b,s.c from 1,173 s select s.a,s.b,s.c from 123 s combine to select s.a,s.b,s.c from 1,173,123 s Also split off UNION clauses to see if the new clause can be merged into an existing UNION clause.

### instancesByPattern

public static String instancesByPattern(Pattern pattern, boolean includeSubclasses)
Return all instances of classes matching a given regular expression.

### classesByPattern

public static String classesByPattern(Pattern pattern, boolean includeSubclasses)
Returns all classes matching a given regular expression.

### instancesByClassLoaderId

public static String instancesByClassLoaderId(int classLoaderId)
Returns an OQL query string to select all objects loaded by the given class loader.

           select *
           from
           (
                select *
                from java.lang.Class c
                where
                    c implements org.eclipse.mat.snapshot.model.IClass
                    and c.@classLoaderId = {0}
           )

Parameters:
  `classLoaderId` - the object id of the class loader
Returns:
  an OQL query selecting all objects loaded by the class loader

### classesByClassLoaderId

public static String classesByClassLoaderId(int classLoaderId)
Returns an OQL query string to select all classes loaded by the given class loader.

           select *
           from java.lang.Class c
           where
                c implements org.eclipse.mat.snapshot.model.IClass
                and c.@classLoaderId = {0}

Parameters:
  `classLoaderId` - the object id of the class loader
Returns:
  an OQL query selecting all classes loaded by the class loader