Package org.eclipse.mat.parser.model
Class InstanceImpl
java.lang.Object
org.eclipse.mat.parser.model.AbstractObjectImpl
org.eclipse.mat.parser.model.InstanceImpl
- All Implemented Interfaces:
Serializable
,IInstance
,IObject
- Direct Known Subclasses:
ClassLoaderImpl
Implementation of a plain Java object.
This includes field information.
- See Also:
- No Extend:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.mat.snapshot.model.IObject
IObject.Type
-
Constructor Summary
ConstructorDescriptionInstanceImpl
(int objectId, long address, ClassImpl clazz, List<Field> fields) Construct a representation of plain java object in the snapshot. -
Method Summary
Modifier and TypeMethodDescriptionReturns the field identified by the name.Returns all fields of the object.long
Get address for the snapshot object.int
Get id for the snapshot object.Get list of snapshot objects referenced from this snapshot object with the name of the field over which it was referenced.Gets the outbound references from this object, as addresses.long
Get used heap size of just this object.Methods inherited from class org.eclipse.mat.parser.model.AbstractObjectImpl
equals, getClassAddress, getClassId, getClassSpecificName, getClazz, getComparatorForClassSpecificName, getComparatorForTechnicalName, getComparatorForUsedHeapSize, getDisplayName, getGCRootInfo, getRetainedHeapSize, getSnapshot, getTechnicalName, hashCode, resolveValue, setClassInstance, setObjectAddress, setObjectId, setSnapshot, toString
Methods inherited from interface org.eclipse.mat.snapshot.model.IObject
getClassSpecificName, getClazz, getDisplayName, getGCRootInfo, getRetainedHeapSize, getSnapshot, getTechnicalName, resolveValue
-
Constructor Details
-
InstanceImpl
Construct a representation of plain java object in the snapshot.- Parameters:
objectId
- the object idaddress
- the actual addressclazz
- the type of the objectfields
- the instance fields of the object (the static fields are held in the class)
-
-
Method Details
-
getObjectAddress
public long getObjectAddress()Description copied from interface:IObject
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.- Specified by:
getObjectAddress
in interfaceIObject
- Overrides:
getObjectAddress
in classAbstractObjectImpl
- Returns:
- address for the snapshot object
-
getObjectId
public int getObjectId()Description copied from interface:IObject
Get 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:
getObjectId
in interfaceIObject
- Overrides:
getObjectId
in classAbstractObjectImpl
- Returns:
- id for the snapshot object
-
getFields
Description copied from interface:IInstance
Returns all fields of the object.Fields are ordered in such a way, that first fields defined in the current class and then fields of the super class and its super classes are returned. This order is important to know, if a class declares a field by the same name as the class it inherits from.
-
getField
Description copied from interface:IInstance
Returns the field identified by the name.If declares a member variable by the same name as the parent class does, then the result of this method is undefined.
-
getUsedHeapSize
public long getUsedHeapSize()Description copied from interface:IObject
Get used heap size of just this object.- Specified by:
getUsedHeapSize
in interfaceIObject
- Specified by:
getUsedHeapSize
in classAbstractObjectImpl
- Returns:
- used heap size of this object
-
getReferences
Description copied from class:AbstractObjectImpl
Gets the outbound references from this object, as addresses.- Specified by:
getReferences
in classAbstractObjectImpl
- Returns:
- a list of outbound references
-
getOutboundReferences
Description copied from interface:IObject
Get list of snapshot objects referenced from this snapshot object with the name of the field over which it was referenced.- Specified by:
getOutboundReferences
in interfaceIObject
- Returns:
- list of snapshot objects referenced from this snapshot object with the name of the field over which it was referenced
-