Package org.openjdk.jol.info
Class ClassData
java.lang.Object
org.openjdk.jol.info.ClassData
Holds the class data, without the layout information.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
private
Constructs the empty ClassData, suited for regular class.Constructs the empty ClassData, suited for arrays. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the field data.void
addSuperClass
(String superClass) Add the super-class into the hierarchy.void
addSuperClassData
(Class superClass) Add the super-class data of the class.void
addSuperClassData
(ClassData superClassData) Add the super-class data of the class.Answer the array class for this class data.Answer the array component class for this class data.long
Answer the array length for this class data.private static int
Get the class names in the hierarchy, starting from the superclasses down to subclassesboolean
fields()
Get the fields' data, including all the fields in the hierarchy.Get the fields' data for the given class.int
hashCode()
instance()
boolean
isArray()
Is this class data for the array?boolean
Does the class have @Contended annotation?void
Merge this class data with the super-class class dataname()
Answer class nameint
Returns the count of the oops in th classGet the fields' of the own fields.private static ClassData
static ClassData
parseClass
(Class klass) Parse the existing class.static ClassData
Parse the existing instance.Get ClassData of the super-class.private WeakReference<Object>
wrapInstance
(Object instance)
-
Field Details
-
instance
-
name
-
fields
-
classNames
-
arrayKlass
-
arrayComponentKlass
-
length
private final long length -
isArray
private final boolean isArray -
isContended
private boolean isContended -
superClass
-
-
Constructor Details
-
ClassData
Constructs the empty ClassData, suited for regular class.- Parameters:
name
- class name
-
ClassData
-
ClassData
Constructs the empty ClassData, suited for arrays.- Parameters:
arrayKlass
- array class, e.g. "int[]"componentKlass
- , e.g. "int"length
- array length
-
ClassData
-
-
Method Details
-
parseInstance
Parse the existing instance.- Parameters:
o
- object instance to parse- Returns:
- class data instance
-
parseClass
Parse the existing class.- Parameters:
klass
- class to parse- Returns:
- class data instance
-
arrayLength
-
parse
-
wrapInstance
-
addSuperClass
Add the super-class into the hierarchy.- Parameters:
superClass
- super class name
-
addSuperClassData
Add the super-class data of the class.- Parameters:
superClass
- super class
-
addSuperClassData
Add the super-class data of the class.- Parameters:
superClassData
- parsed super class
-
addField
Add the field data.- Parameters:
fieldData
- the data to add
-
fields
Get the fields' data, including all the fields in the hierarchy.- Returns:
- field data
-
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
Get the fields' data for the given class.- Parameters:
klass
- class name- Returns:
- field data
-
classHierarchy
Get the class names in the hierarchy, starting from the superclasses down to subclasses- Returns:
- list of class names
-
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
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
Answer the array class for this class data.- Returns:
- array class name, e.g. "int[]".
-
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
Merge this class data with the super-class class data- Parameters:
superClassData
- super class data
-
equals
-
hashCode
public int hashCode() -
instance
- Returns:
- the recorded instance, if available
-