org.eclipse.mat.snapshot.model
Interface IObject

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
IArray, IClass, IClassLoader, IInstance, IObjectArray, IPrimitiveArray
All Known Implementing Classes:
AbstractArrayImpl, AbstractObjectImpl, ClassImpl, ClassLoaderImpl, InstanceImpl, ObjectArrayImpl, PrimitiveArrayImpl

public interface IObject
extends java.io.Serializable

Base interface for all objects found in a snapshot. Other model interfaces derive from this interface, e.g. for classes, plain objects, object arrays, primitive arrays...


Nested Class Summary
static interface IObject.Type
          The type of the primitive array.
 
Method Summary
 java.lang.String getClassSpecificName()
          Get class specific name of this object which depends on the availability of the appropriate name resolver, e.g.
 IClass getClazz()
          Get class snapshot object this object is an instance of.
 java.lang.String getDisplayName()
          Get concatenation of getTechnicalName() and getClassSpecificName().
 GCRootInfo[] getGCRootInfo()
          Get GCRootInfo if the object is a garbage collection root or null otherwise.
 long getObjectAddress()
          Get address for the snapshot object.
 int getObjectId()
          Get id for the snapshot object.
 java.util.List<NamedReference> getOutboundReferences()
          Get list of snapshot objects referenced from this snapshot object with the name of the field over which it was referenced.
 long getRetainedHeapSize()
          Get retained heap size of this object.
 ISnapshot getSnapshot()
          Returns the snapshot from which this object has been read.
 java.lang.String getTechnicalName()
          Get technical name of this object which is something like class@address.
 long getUsedHeapSize()
          Get used heap size of just this object.
 java.lang.Object resolveValue(java.lang.String field)
          Resolves and returns the value of a field specified by a dot notation.
 

Method Detail

getObjectId

int getObjectId()
Get id for the snapshot object. The id is not the address, but an internally assigned number fitting into an int (this helps reducing the memory footprint of the snapshot considerably - addresses are only used for visualization purposes).

Returns:
id for the snapshot object

getObjectAddress

long getObjectAddress()
Get address for the snapshot object. This is the address at which the object was stored in memory. Use the address only for visualization purposes and try to use the id wherever possible as the snapshot API is optimized to handle ids and not addresses. Addresses are bigger ( long), have no consecutive order (with gaps), and are not used for hashing.

Returns:
address for the snapshot object

getClazz

IClass getClazz()
Get class snapshot object this object is an instance of.

Returns:
class snapshot object this object is an instance of

getUsedHeapSize

long getUsedHeapSize()
Get used heap size of just this object.

Returns:
used heap size of this object
Since:
1.0

getRetainedHeapSize

long getRetainedHeapSize()
Get retained heap size of this object.

Returns:
retained heap size of this object (returns 0 if the dominator tree wasn't calculated for the corresponding snapshot)

getTechnicalName

java.lang.String getTechnicalName()
Get technical name of this object which is something like class@address.

Returns:
technical name of this object which is something like class@address

getClassSpecificName

java.lang.String getClassSpecificName()
Get class specific name of this object which depends on the availability of the appropriate name resolver, e.g. for a String the value of the char[].

Returns:
class specific name of the given snapshot object or null if it can't be resolved

getDisplayName

java.lang.String getDisplayName()
Get concatenation of getTechnicalName() and getClassSpecificName().

Returns:
concatenation of getTechnicalName() and getClassSpecificName()

getOutboundReferences

java.util.List<NamedReference> getOutboundReferences()
Get list of snapshot objects referenced from this snapshot object with the name of the field over which it was referenced.

Returns:
list of snapshot objects referenced from this snapshot object with the name of the field over which it was referenced

resolveValue

java.lang.Object resolveValue(java.lang.String field)
                              throws SnapshotException
Resolves and returns the value of a field specified by a dot notation. If the field is a primitive type, the value the returns the corresponding object wrapper, e.g. a java.lang.Boolean is returned for a field of type boolean. If the field is an object reference, the corresponding IObject is returned.

The field can be specified using the dot notation, i.e. object references are followed and its fields are evaluated. If any of the object references is null, null is returned.

Parameters:
field - the field name in dot notation
Returns:
the value of the field
Throws:
SnapshotException

getGCRootInfo

GCRootInfo[] getGCRootInfo()
                           throws SnapshotException
Get GCRootInfo if the object is a garbage collection root or null otherwise. An object may or may not be a garbage collection root, it may even be one for multiple reasons (described in the GCRootInfo object).

Returns:
GCRootInfo if the object is a garbage collection root or null otherwise
Throws:
SnapshotException

getSnapshot

ISnapshot getSnapshot()
Returns the snapshot from which this object has been read.

Returns:
the snapshot from which this object has been read.