Class InstanceImpl

    • Constructor Detail

      • InstanceImpl

        public InstanceImpl​(int objectId,
                            long address,
                            ClassImpl clazz,
                            java.util.List<Field> fields)
        Construct a representation of plain java object in the snapshot.
        Parameters:
        objectId - the object id
        address - the actual address
        clazz - the type of the object
        fields - the instance fields of the object (the static fields are held in the class)
    • Method Detail

      • 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 interface IObject
        Overrides:
        getObjectAddress in class AbstractObjectImpl
        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 an int (this helps reducing the memory footprint of the snapshot considerably - addresses are only used for visualization purposes).
        Specified by:
        getObjectId in interface IObject
        Overrides:
        getObjectId in class AbstractObjectImpl
        Returns:
        id for the snapshot object
      • getFields

        public java.util.List<Field> 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.

        Specified by:
        getFields in interface IInstance
        Returns:
        a list of the fields
      • getField

        public Field getField​(java.lang.String name)
        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.

        Specified by:
        getField in interface IInstance
        Parameters:
        name - the name of the field
        Returns:
        the field
      • getOutboundReferences

        public java.util.List<NamedReference> 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 interface IObject
        Returns:
        list of snapshot objects referenced from this snapshot object with the name of the field over which it was referenced