org.openjdk.jol.info
Class ClassData

java.lang.Object
  extended by org.openjdk.jol.info.ClassData

public class ClassData
extends Object

Holds the class data, without the layout information.

Author:
Aleksey Shipilev
See Also:
Layouter

Constructor Summary
ClassData(String name)
          Constructs the empty ClassData, suited for regular class.
ClassData(String arrayKlass, String componentKlass, int length)
          Constructs the empty ClassData, suited for arrays.
 
Method Summary
 void addField(FieldData fieldData)
          Add the field data.
 void addSuperClass(String superClass)
          Add the super-class into the hierarchy.
 String arrayClass()
          Answer the array class for this class data.
 String arrayComponentType()
          Answer the array component class for this class data.
 int arrayLength()
          Answer the array length for this class data.
 List<String> classHierarchy()
          Get the class names in the hierarchy, starting from the superclasses down to subclasses
 boolean equals(Object o)
           
 Collection<FieldData> fields()
          Get the fields' data, including all the fields in the hierarchy.
 Collection<FieldData> fieldsFor(String klass)
          Get the fields' data for the given class.
 int hashCode()
           
 boolean isArray()
          Is this class data for the array?
 void merge(ClassData superClassData)
          Merge this class data with the super-class class data
 String name()
          Answer class name
static ClassData parseArray(Class arrayClass, int length)
          Simulate the array instance.
static ClassData parseClass(Class klass)
          Parse the existing class.
static ClassData parseInstance(Object o)
          Parse the existing instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassData

public ClassData(String name)
Constructs the empty ClassData, suited for regular class.


ClassData

public ClassData(String arrayKlass,
                 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
Method Detail

parseInstance

public static ClassData parseInstance(Object o)
Parse the existing instance.

Parameters:
o - object instance to parse
Returns:
class data instance

parseArray

public static ClassData parseArray(Class arrayClass,
                                   int length)
Simulate the array instance.

Parameters:
arrayClass - array class, e.g. int[].class
length - array length
Returns:
class data instance

parseClass

public static ClassData parseClass(Class klass)
Parse the existing class.

Parameters:
klass - class to parse
Returns:
class data instance

addSuperClass

public void addSuperClass(String superClass)
Add the super-class into the hierarchy.

Parameters:
superClass - super class name

addField

public void addField(FieldData fieldData)
Add the field data.

Parameters:
fieldData - the data to add

fields

public Collection<FieldData> fields()
Get the fields' data, including all the fields in the hierarchy.

Returns:
field data

fieldsFor

public Collection<FieldData> fieldsFor(String klass)
Get the fields' data for the given class.

Parameters:
klass - class name
Returns:
field data

classHierarchy

public List<String> classHierarchy()
Get the class names in the hierarchy, starting from the superclasses down to subclasses

Returns:
list of class names

name

public 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

arrayClass

public String arrayClass()
Answer the array class for this class data.

Returns:
array class name, e.g. "int[]".

arrayComponentType

public String arrayComponentType()
Answer the array component class for this class data.

Returns:
array component class name, e.g. "int" for int[] array.

arrayLength

public int 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(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2013. All Rights Reserved.