org.netbeans.lib.profiler.heap
Interface JavaClass

All Superinterfaces:
Type
All Known Implementing Classes:
MissingInstanceType

public interface JavaClass
extends Type

This class represents java.lang.Class instances on the heap.

Author:
Tomas Hurka

Method Summary
 long getAllInstancesSize()
          returns the size of all instances in bytes.
 Instance getClassLoader()
          returns Instance representing class loader of this class.
 List<Field> getFields()
          returns List of instance fields of this JavaClass.
 List<Instance> getInstances()
          computes the list of all Instance of this class.
 int getInstancesCount()
          gets number of instances of this class.
 int getInstanceSize()
          returns the size of the Instance in bytes if this JavaClass does not represent array.
 long getJavaClassId()
          gets unique (in whole heap) ID of this JavaClass.
 String getName()
          return human readable name of the class.
 long getRetainedSizeByClass()
          gets sum of retained sizes of all class instances.
 List<FieldValue> getStaticFieldValues()
          computes the list of instance field values.
 Collection<JavaClass> getSubClasses()
          returns all subclasses of this class.
 JavaClass getSuperClass()
          returns JavaClass representing super class of this class.
 Object getValueOfStaticField(String name)
          Returns a value object that reflects the specified static field of the class represented by this JavaClass object.
 boolean isArray()
          returns true if this JavaClass represents array (for example: java.lang.String[]).
 

Method Detail

getValueOfStaticField

Object getValueOfStaticField(String name)
Returns a value object that reflects the specified static field of the class represented by this JavaClass object. The name parameter is a String that specifies the simple name of the desired static field.
Speed: normal

Parameters:
name - the name of the field
Returns:
the value for the specified static field in this class. If a static field with the specified name is not found null is returned. If the field.getType() is Type object Instance is returned as field value, for primitive types its corresponding object wrapper (Boolean, Integer, Float, etc.) is returned.

getAllInstancesSize

long getAllInstancesSize()
returns the size of all instances in bytes. For non array classes this is computed as getInstancesCount()*getInstanceSize(). Instance size of all instances is summed for arrays.
Speed: normal

Returns:
the size of all instances in bytes

isArray

boolean isArray()
returns true if this JavaClass represents array (for example: java.lang.String[]).
Speed: fast

Returns:
true if this class represents array, false otherwise

getClassLoader

Instance getClassLoader()
returns Instance representing class loader of this class.
Speed: fast

Returns:
class loader

getFields

List<Field> getFields()
returns List of instance fields of this JavaClass.
Speed: normal

Returns:
list of Field instance fields

getInstanceSize

int getInstanceSize()
returns the size of the Instance in bytes if this JavaClass does not represent array. For arrays -1 is returned
Speed: fast

Returns:
returns the size of the Instance in bytes, for arrays -1 is returned.

getInstances

List<Instance> getInstances()
computes the list of all Instance of this class. The instances are ordered according to Instance.getInstanceNumber()
Speed: slow

Returns:
list Instance of instances

getInstancesCount

int getInstancesCount()
gets number of instances of this class.
Speed: first invocation is slow, all subsequent invocations are fast

Returns:
number of instances

getRetainedSizeByClass

long getRetainedSizeByClass()
gets sum of retained sizes of all class instances.
Speed: first invocation is slow, all subsequent invocations are fast

Returns:
sum of retained sizes of all class instances

getJavaClassId

long getJavaClassId()
gets unique (in whole heap) ID of this JavaClass.
Speed: fast

Returns:
ID of this JavaClass

getName

String getName()
return human readable name of the class. Innerclasses are separated by $. Anonymous classes uses $1 $2 etc. Arrays uses [] after the class or primitive type name
Speed: fast

Specified by:
getName in interface Type
Returns:
name of the class

getStaticFieldValues

List<FieldValue> getStaticFieldValues()
computes the list of instance field values. The order is fields of this class followed by super class, etc.
Speed: normal

Returns:
list of FieldValue instance field values.

getSubClasses

Collection<JavaClass> getSubClasses()
returns all subclasses of this class. This method works recursively so it returns also subclasses of subclasses etc.
Speed: slow

Returns:
returns the Collection of JavaClass.

getSuperClass

JavaClass getSuperClass()
returns JavaClass representing super class of this class.
Speed: fast

Returns:
super class (super class of java.lang.Object is null)


Copyright © 2018. All Rights Reserved.