Class ClassImpl

    • Constructor Detail

      • ClassImpl

        public ClassImpl​(long address,
                         String name,
                         long superAddress,
                         long loaderAddress,
                         Field[] staticFields,
                         FieldDescriptor[] fields)
        Construct a class object based on name, address and fields.
        Parameters:
        address - the address of the class object
        name - the class name, using '.' as package separator
        superAddress - the address of the superclass, or 0 if none.
        loaderAddress - the address of the class loader
        staticFields - all the static fields, with values
        fields - all the instance fields as descriptors
    • Method Detail

      • getCacheEntry

        public Serializable getCacheEntry()
        Gets the key for extra information about this class.
        Returns:
        the key
      • setCacheEntry

        public void setCacheEntry​(Serializable cacheEntry)
        Sets the key for extra information about this class.
        Parameters:
        cacheEntry - the key
      • setSuperClassIndex

        public void setSuperClassIndex​(int superClassIndex)
        Sets the superclass index. May need to be changed after reindexing of a snapshot.
        Parameters:
        superClassIndex - the new index
      • setClassLoaderIndex

        public void setClassLoaderIndex​(int classLoaderIndex)
        Sets the class loader index. May need to be changed after reindexing of a snapshot.
        Parameters:
        classLoaderIndex - the new index
      • getOutboundReferences

        public 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
      • getClassLoaderAddress

        public long getClassLoaderAddress()
        Description copied from interface: IClass
        Returns the address of the class loader which loaded this class.
        Specified by:
        getClassLoaderAddress in interface IClass
      • setClassLoaderAddress

        public void setClassLoaderAddress​(long address)
      • getFieldDescriptors

        public List<FieldDescriptor> getFieldDescriptors()
        Description copied from interface: IClass
        Returns field descriptors for all member variables of instances of this class. If the snapshot data format does not contain field data then this will be an empty list.
        Specified by:
        getFieldDescriptors in interface IClass
      • getNumberOfObjects

        public int getNumberOfObjects()
        Description copied from interface: IClass
        Returns the number of instances of this class present in the heap dump.
        Specified by:
        getNumberOfObjects in interface IClass
      • getHeapSizePerInstance

        public long getHeapSizePerInstance()
        Description copied from interface: IClass
        Returns the heap size of one instance of this class. Not valid if this class represents an array.
        Specified by:
        getHeapSizePerInstance in interface IClass
        Since:
        1.0
      • setHeapSizePerInstance

        public void setHeapSizePerInstance​(long size)
        Since:
        1.0
      • getName

        public String getName()
        Description copied from interface: IClass
        Returns the fully qualified class name of this class. The package components are separated by dots '.'. Inner classes use $ to separate the parts.
        Specified by:
        getName in interface IClass
      • setName

        public void setName​(String name)
      • getStaticFields

        public List<Field> getStaticFields()
        Description copied from interface: IClass
        Returns the static fields and it values. If the snapshot data format does not contain field data then this will be an empty list.
        Specified by:
        getStaticFields in interface IClass
      • getSuperClassAddress

        public long getSuperClassAddress()
      • getSuperClassId

        public int getSuperClassId()
        Description copied from interface: IClass
        Returns the id of the super class. -1 if it has no super class, i.e. if it is java.lang.Object.
        Specified by:
        getSuperClassId in interface IClass
      • getTotalSize

        public long getTotalSize()
      • hasSuperClass

        public boolean hasSuperClass()
        Description copied from interface: IClass
        Returns true if the class has a super class.
        Specified by:
        hasSuperClass in interface IClass
      • addInstance

        public void addInstance​(long usedHeapSize)
        Since:
        1.0
      • removeInstance

        public void removeInstance​(long heapSizePerInstance)
        Since:
        1.0
      • getSubclasses

        public List<IClass> getSubclasses()
        Description copied from interface: IClass
        Returns the direct sub-classes.
        Specified by:
        getSubclasses in interface IClass
      • getAllSubclasses

        public List<IClass> getAllSubclasses()
        Description copied from interface: IClass
        Returns all sub-classes including sub-classes of its sub-classes.
        Specified by:
        getAllSubclasses in interface IClass
      • isArrayType

        public boolean isArrayType()
        Description copied from interface: IClass
        Returns true if the class is an array class.
        Specified by:
        isArrayType in interface IClass
      • getTechnicalName

        public String getTechnicalName()
        Description copied from interface: IObject
        Get technical name of this object which is something like class@address.
        Specified by:
        getTechnicalName in interface IObject
        Overrides:
        getTechnicalName in class AbstractObjectImpl
        Returns:
        technical name of this object which is something like class@address
      • getClassLoaderId

        public int getClassLoaderId()
        Description copied from interface: IClass
        Returns the id of the class loader which loaded this class.
        Specified by:
        getClassLoaderId in interface IClass
      • addSubClass

        public void addSubClass​(ClassImpl clazz)
      • removeSubClass

        public void removeSubClass​(ClassImpl clazz)
      • setUsedHeapSize

        public void setUsedHeapSize​(long usedHeapSize)
        Since:
        1.0
      • doesExtend

        public boolean doesExtend​(String className)
                           throws SnapshotException
        Description copied from interface: IClass
        Does this class extend a class of the supplied name? With multiple class loaders the supplied name might not be the class you were intending to find.
        Specified by:
        doesExtend in interface IClass
        Returns:
        true if it does extend
        Throws:
        SnapshotException
      • setSnapshot

        public void setSnapshot​(ISnapshot dump)
        Description copied from class: AbstractObjectImpl
        Set the snapshot for an object. Used once the entire snapshot has been built, or an object has been deserialized.
        Overrides:
        setSnapshot in class AbstractObjectImpl
        Parameters:
        dump - the actual current snapshot