Package org.eclipse.mat.parser.model
Class AbstractObjectImpl
- java.lang.Object
-
- org.eclipse.mat.parser.model.AbstractObjectImpl
-
- All Implemented Interfaces:
Serializable,IObject
- Direct Known Subclasses:
AbstractArrayImpl,ClassImpl,InstanceImpl
public abstract class AbstractObjectImpl extends Object implements IObject, Serializable
The general implementation of any Java object (plain object, array, class, classloader).- See Also:
- Serialized Form
- No Extend:
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.mat.snapshot.model.IObject
IObject.Type
-
-
Constructor Summary
Constructors Constructor Description AbstractObjectImpl(int objectId, long address, ClassImpl classInstance)Construct a general object, called from subclass.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(Object obj)longgetClassAddress()Returns the address of the class which is the type of this object.intgetClassId()Returns the id of the class which is the type of this object.StringgetClassSpecificName()Get class specific name of this object which depends on the availability of the appropriate name resolver, e.g.ClassImplgetClazz()Get class snapshot object this object is an instance of.static Comparator<AbstractObjectImpl>getComparatorForClassSpecificName()Deprecated.static Comparator<AbstractObjectImpl>getComparatorForTechnicalName()Deprecated.static Comparator<AbstractObjectImpl>getComparatorForUsedHeapSize()Deprecated.StringgetDisplayName()Get concatenation ofIObject.getTechnicalName()andIObject.getClassSpecificName().GCRootInfo[]getGCRootInfo()GetGCRootInfoif the object is a garbage collection root or null otherwise.longgetObjectAddress()Get address for the snapshot object.intgetObjectId()Get id for the snapshot object.abstract ArrayLonggetReferences()Gets the outbound references from this object, as addresses.longgetRetainedHeapSize()Get retained heap size of this object.ISnapshotgetSnapshot()Returns the snapshot from which this object has been read.StringgetTechnicalName()Get technical name of this object which is something like class@address.abstract longgetUsedHeapSize()Get used heap size of just this object.inthashCode()ObjectresolveValue(String name)Resolves and returns the value of a field specified by a dot notation.voidsetClassInstance(ClassImpl classInstance)Changes the type of the object.voidsetObjectAddress(long address)Used to set the address, for example after reconstructing an object from a file.voidsetObjectId(int objectId)Set the index for the objectvoidsetSnapshot(ISnapshot dump)Set the snapshot for an object.StringtoString()-
Methods inherited from interface org.eclipse.mat.snapshot.model.IObject
getOutboundReferences
-
-
-
-
Constructor Detail
-
AbstractObjectImpl
public AbstractObjectImpl(int objectId, long address, ClassImpl classInstance)Construct a general object, called from subclass.- Parameters:
objectId- the index of the objectaddress- the actual addressclassInstance- the type of the object
-
-
Method Detail
-
getObjectAddress
public long getObjectAddress()
Description copied from interface:IObjectGet 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.- Specified by:
getObjectAddressin interfaceIObject- Returns:
- address for the snapshot object
-
getObjectId
public int getObjectId()
Description copied from interface:IObjectGet id for the snapshot object. The id is not the address, but an internally assigned number fitting into anint(this helps reducing the memory footprint of the snapshot considerably - addresses are only used for visualization purposes).- Specified by:
getObjectIdin interfaceIObject- Returns:
- id for the snapshot object
-
setObjectAddress
public void setObjectAddress(long address)
Used to set the address, for example after reconstructing an object from a file.- Parameters:
address-
-
setObjectId
public void setObjectId(int objectId)
Set the index for the object- Parameters:
objectId- the index into all the indexes for other object data
-
getClazz
public ClassImpl getClazz()
Description copied from interface:IObjectGet class snapshot object this object is an instance of.
-
getClassAddress
public long getClassAddress()
Returns the address of the class which is the type of this object.- Returns:
- the address
-
getClassId
public int getClassId()
Returns the id of the class which is the type of this object.- Returns:
- the id
-
setClassInstance
public void setClassInstance(ClassImpl classInstance)
Changes the type of the object. Used when constructing a ClassImpl for java.lang.Class.- Parameters:
classInstance-
-
setSnapshot
public void setSnapshot(ISnapshot dump)
Set the snapshot for an object. Used once the entire snapshot has been built, or an object has been deserialized.- Parameters:
dump- the actual current snapshot
-
getSnapshot
public ISnapshot getSnapshot()
Description copied from interface:IObjectReturns the snapshot from which this object has been read.- Specified by:
getSnapshotin interfaceIObject- Returns:
- the snapshot from which this object has been read.
-
getUsedHeapSize
public abstract long getUsedHeapSize()
Description copied from interface:IObjectGet used heap size of just this object.- Specified by:
getUsedHeapSizein interfaceIObject- Returns:
- used heap size of this object
- Since:
- 1.0
-
getRetainedHeapSize
public long getRetainedHeapSize()
Description copied from interface:IObjectGet retained heap size of this object.- Specified by:
getRetainedHeapSizein interfaceIObject- Returns:
- retained heap size of this object (returns 0 if the dominator tree wasn't calculated for the corresponding snapshot)
-
getReferences
public abstract ArrayLong getReferences()
Gets the outbound references from this object, as addresses.- Returns:
- a list of outbound references
-
getClassSpecificName
public String getClassSpecificName()
Description copied from interface:IObjectGet 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[].- Specified by:
getClassSpecificNamein interfaceIObject- Returns:
- class specific name of the given snapshot object or null if it can't be resolved
-
getTechnicalName
public String getTechnicalName()
Description copied from interface:IObjectGet technical name of this object which is something like class@address.- Specified by:
getTechnicalNamein interfaceIObject- Returns:
- technical name of this object which is something like class@address
-
getDisplayName
public String getDisplayName()
Description copied from interface:IObjectGet concatenation ofIObject.getTechnicalName()andIObject.getClassSpecificName().- Specified by:
getDisplayNamein interfaceIObject- Returns:
- concatenation of
IObject.getTechnicalName()andIObject.getClassSpecificName()
-
resolveValue
public final Object resolveValue(String name) throws SnapshotException
Description copied from interface:IObjectResolves 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.
- Specified by:
resolveValuein interfaceIObject- Parameters:
name- the field name in dot notation- Returns:
- the value of the field
- Throws:
SnapshotException
-
getGCRootInfo
public GCRootInfo[] getGCRootInfo() throws SnapshotException
Description copied from interface:IObjectGetGCRootInfoif 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 theGCRootInfoobject).- Specified by:
getGCRootInfoin interfaceIObject- Returns:
GCRootInfoif the object is a garbage collection root or null otherwise- Throws:
SnapshotException
-
getComparatorForTechnicalName
@Deprecated public static Comparator<AbstractObjectImpl> getComparatorForTechnicalName()
Deprecated.Gets a comparator for sorting objects by technical name - type plus address. Appears to be unused, and currently only returns null, so do not use.- Returns:
- null
-
getComparatorForClassSpecificName
@Deprecated public static Comparator<AbstractObjectImpl> getComparatorForClassSpecificName()
Deprecated.Gets a comparator for sorting objects by resolved name description. Appears to be unused, and currently only returns null, so do not use.- Returns:
- null
-
getComparatorForUsedHeapSize
@Deprecated public static Comparator<AbstractObjectImpl> getComparatorForUsedHeapSize()
Deprecated.Gets a comparator for sorting objects by used heap size. Appears to be unused, and currently only returns null, so do not use.- Returns:
- null
-
-