Class ClassData


  • public class ClassData
    extends java.lang.Object
    Holds the class data, without the layout information.
    See Also:
    Layouter
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ClassData​(java.lang.Object instance, java.lang.String name)  
      private ClassData​(java.lang.Object instance, java.lang.String arrayKlass, java.lang.String componentKlass, int length)  
        ClassData​(java.lang.String name)
      Constructs the empty ClassData, suited for regular class.
        ClassData​(java.lang.String arrayKlass, java.lang.String componentKlass, int length)
      Constructs the empty ClassData, suited for arrays.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addField​(FieldData fieldData)
      Add the field data.
      void addSuperClass​(java.lang.String superClass)
      Add the super-class into the hierarchy.
      void addSuperClassData​(java.lang.Class superClass)
      Add the super-class data of the class.
      void addSuperClassData​(ClassData superClassData)
      Add the super-class data of the class.
      java.lang.String arrayClass()
      Answer the array class for this class data.
      java.lang.String arrayComponentType()
      Answer the array component class for this class data.
      long arrayLength()
      Answer the array length for this class data.
      private static int arrayLength​(java.lang.Object o)  
      java.util.List<java.lang.String> classHierarchy()
      Get the class names in the hierarchy, starting from the superclasses down to subclasses
      boolean equals​(java.lang.Object o)  
      java.util.List<FieldData> fields()
      Get the fields' data, including all the fields in the hierarchy.
      java.util.List<FieldData> fieldsFor​(java.lang.String klass)
      Get the fields' data for the given class.
      int hashCode()  
      java.lang.Object instance()  
      boolean isArray()
      Is this class data for the array?
      boolean isContended()
      Does the class have @Contended annotation?
      void merge​(ClassData superClassData)
      Merge this class data with the super-class class data
      java.lang.String name()
      Answer class name
      int oopsCount()
      Returns the count of the oops in th class
      java.util.List<FieldData> ownFields()
      Get the fields' of the own fields.
      private static ClassData parse​(java.lang.Object o, java.lang.Class klass)  
      static ClassData parseClass​(java.lang.Class klass)
      Parse the existing class.
      static ClassData parseInstance​(java.lang.Object o)
      Parse the existing instance.
      ClassData superClass()
      Get ClassData of the super-class.
      private java.lang.ref.WeakReference<java.lang.Object> wrapInstance​(java.lang.Object instance)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • instance

        private final java.lang.ref.WeakReference<java.lang.Object> instance
      • name

        private final java.lang.String name
      • fields

        private final java.util.List<FieldData> fields
      • classNames

        private final java.util.List<java.lang.String> classNames
      • arrayKlass

        private final java.lang.String arrayKlass
      • arrayComponentKlass

        private final java.lang.String arrayComponentKlass
      • length

        private final long length
      • isArray

        private final boolean isArray
      • isContended

        private boolean isContended
    • Constructor Detail

      • ClassData

        public ClassData​(java.lang.String name)
        Constructs the empty ClassData, suited for regular class.
        Parameters:
        name - class name
      • ClassData

        private ClassData​(java.lang.Object instance,
                          java.lang.String name)
      • ClassData

        public ClassData​(java.lang.String arrayKlass,
                         java.lang.String componentKlass,
                         int length)
        Constructs the empty ClassData, suited for arrays.
        Parameters:
        arrayKlass - array class, e.g. "int[]"
        componentKlass - , e.g. "int"
        length - array length
      • ClassData

        private ClassData​(java.lang.Object instance,
                          java.lang.String arrayKlass,
                          java.lang.String componentKlass,
                          int length)
    • Method Detail

      • parseInstance

        public static ClassData parseInstance​(java.lang.Object o)
        Parse the existing instance.
        Parameters:
        o - object instance to parse
        Returns:
        class data instance
      • parseClass

        public static ClassData parseClass​(java.lang.Class klass)
        Parse the existing class.
        Parameters:
        klass - class to parse
        Returns:
        class data instance
      • arrayLength

        private static int arrayLength​(java.lang.Object o)
      • parse

        private static ClassData parse​(java.lang.Object o,
                                       java.lang.Class klass)
      • wrapInstance

        private java.lang.ref.WeakReference<java.lang.Object> wrapInstance​(java.lang.Object instance)
      • addSuperClass

        public void addSuperClass​(java.lang.String superClass)
        Add the super-class into the hierarchy.
        Parameters:
        superClass - super class name
      • addSuperClassData

        public void addSuperClassData​(java.lang.Class superClass)
        Add the super-class data of the class.
        Parameters:
        superClass - super class
      • addSuperClassData

        public void addSuperClassData​(ClassData superClassData)
        Add the super-class data of the class.
        Parameters:
        superClassData - parsed super class
      • addField

        public void addField​(FieldData fieldData)
        Add the field data.
        Parameters:
        fieldData - the data to add
      • fields

        public java.util.List<FieldData> fields()
        Get the fields' data, including all the fields in the hierarchy.
        Returns:
        field data
      • ownFields

        public java.util.List<FieldData> ownFields()
        Get the fields' of the own fields.
        Returns:
        field data
      • oopsCount

        public int oopsCount()
        Returns the count of the oops in th class
        Returns:
        oops count
      • fieldsFor

        public java.util.List<FieldData> fieldsFor​(java.lang.String klass)
        Get the fields' data for the given class.
        Parameters:
        klass - class name
        Returns:
        field data
      • classHierarchy

        public java.util.List<java.lang.String> classHierarchy()
        Get the class names in the hierarchy, starting from the superclasses down to subclasses
        Returns:
        list of class names
      • name

        public java.lang.String name()
        Answer class name
        Returns:
        string representation of class name
      • isArray

        public boolean isArray()
        Is this class data for the array?
        Returns:
        true, if class data represents the array; false otherwise
      • superClass

        public ClassData superClass()
        Get ClassData of the super-class.
        Returns:
        ClassData
      • isContended

        public boolean isContended()
        Does the class have @Contended annotation?
        Returns:
        true, if class has @Contended annotation; false otherwise
      • arrayClass

        public java.lang.String arrayClass()
        Answer the array class for this class data.
        Returns:
        array class name, e.g. "int[]".
      • arrayComponentType

        public java.lang.String arrayComponentType()
        Answer the array component class for this class data.
        Returns:
        array component class name, e.g. "int" for int[] array.
      • arrayLength

        public long arrayLength()
        Answer the array length for this class data.
        Returns:
        array length
      • merge

        public void merge​(ClassData superClassData)
        Merge this class data with the super-class class data
        Parameters:
        superClassData - super class data
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • instance

        public java.lang.Object instance()
        Returns:
        the recorded instance, if available