com.jrockit.memleak.value
Class ClassInfo

java.lang.Object
  extended by com.jrockit.memleak.value.ClassInfo
All Implemented Interfaces:
IAccessibleInfo, IClassInfo, IClassRef, INamedType, IObjectSpecifier, ITypeSpecifier, IModifyOnce
Direct Known Subclasses:
NameMappingCacheFactory.ClassInfoR26

public class ClassInfo
extends java.lang.Object
implements IClassInfo, IObjectSpecifier, IModifyOnce

Representation of a class, including its name, ID, and class loader info.

Author:
Markus Persson

Field Summary
protected  java.lang.String srcFileName
          Source file name, or null if unknown.
 
Fields inherited from interface com.jrockit.memleak.IClassInfo
ANNOTATION, CLASS_TYPE_NAME, EMPTY_ARRAY, ENUM
 
Fields inherited from interface com.jrockit.memleak.IAccessibleInfo
SYNTHETIC, UNKNOWN_MODIFIERS
 
Fields inherited from interface com.jrockit.memleak.IObjectSpecifier
EMPTY_ARRAY
 
Constructor Summary
ClassInfo(IMemLeak memleak, int classID, java.lang.String name, int modifiers, int numDeclaredStaticFields, int numInstanceFields, java.lang.String srcFileName, IObjectSpecifier classLoaderSpec)
           
 
Method Summary
 boolean equals(java.lang.Object other)
           
 int getClassId()
           
 IObjectInfo getClassLoaderInfo(Policy policy)
          Get the class loader of this class, or null if it is the boot class loader.
 IObjectSpecifier getClassLoaderSpec()
          Get the class loader of this class, or null if it is the boot class loader.
 IObjectInfo getClassObjectInfo(Policy policy)
          For implementations with Feature.CLASS_IDS_ARE_OBJECT_IDS this should never return null (when called with a blocking policy).
 IObjectSpecifier getClassObjectSpec()
          For implementations with Feature.CLASS_IDS_ARE_OBJECT_IDS this should never return null.
 int getModifiers()
           
 java.lang.String getName()
          Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this IClassInfo object.
 int getNumDeclaredStaticFields()
           
 int getNumInstanceFields()
           
 int getObjectId()
           
 java.lang.String getSourceFileName()
          Returns the name of the source file for this class.
 int hashCode()
           
 boolean isArrayClass()
           
 boolean isDiscarded()
           
 boolean overrideDefault(ValueProperty property, java.lang.Object value)
           
<T> T
select(ITypeResolver<T> resolver)
          Select the type or types using operations on resolver.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

srcFileName

protected java.lang.String srcFileName
Source file name, or null if unknown.

Constructor Detail

ClassInfo

public ClassInfo(IMemLeak memleak,
                 int classID,
                 java.lang.String name,
                 int modifiers,
                 int numDeclaredStaticFields,
                 int numInstanceFields,
                 java.lang.String srcFileName,
                 IObjectSpecifier classLoaderSpec)
Parameters:
memleak -
classID -
name -
modifiers -
numDeclaredStaticFields -
numInstanceFields -
srcFileName -
classLoaderSpec - or null
Method Detail

getClassId

public int getClassId()
Specified by:
getClassId in interface IClassRef
Returns:
Returns the class ID.

getClassLoaderSpec

public IObjectSpecifier getClassLoaderSpec()
Description copied from interface: IClassInfo
Get the class loader of this class, or null if it is the boot class loader. Implementations without Feature.CLASS_LOADERS may also return null.

Specified by:
getClassLoaderSpec in interface IClassInfo
Returns:
Returns the IObjectSpecifier of the class loader that loaded this class.

getClassLoaderInfo

public IObjectInfo getClassLoaderInfo(Policy policy)
                               throws GarbageCollectedException
Description copied from interface: IClassInfo
Get the class loader of this class, or null if it is the boot class loader. Null may also be returned if the value is not yet available, according to policy. Finally, implementations without Feature.CLASS_LOADERS may also return null.

Specified by:
getClassLoaderInfo in interface IClassInfo
Returns:
Returns the IObjectInfo of the class loader that loaded this class, or null.
Throws:
GarbageCollectedException

getClassObjectSpec

public IObjectSpecifier getClassObjectSpec()
Description copied from interface: IClassInfo
For implementations with Feature.CLASS_IDS_ARE_OBJECT_IDS this should never return null. Other implementations might.

Specified by:
getClassObjectSpec in interface IClassInfo
Returns:
Returns the IObjectSpecifier of the Class instance that corresponds to this class, or null.

getClassObjectInfo

public IObjectInfo getClassObjectInfo(Policy policy)
                               throws GarbageCollectedException
Description copied from interface: IClassInfo
For implementations with Feature.CLASS_IDS_ARE_OBJECT_IDS this should never return null (when called with a blocking policy). Other implementations might.

Specified by:
getClassObjectInfo in interface IClassInfo
Returns:
Returns the IObjectInfo of the Class instance that corresponds to this class, or null.
Throws:
GarbageCollectedException

getName

public java.lang.String getName()
Description copied from interface: IClassInfo
Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this IClassInfo object.

Specified by:
getName in interface IClassInfo
Specified by:
getName in interface INamedType
Returns:
the name of the class represented by this IClassInfo object.
See Also:
Class.getName()

isArrayClass

public boolean isArrayClass()
Specified by:
isArrayClass in interface IClassInfo
Returns:
true of this is an array class, false otherwise.

hashCode

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

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

select

public <T> T select(ITypeResolver<T> resolver)
Description copied from interface: ITypeSpecifier
Select the type or types using operations on resolver.

NOTE: It is strictly forbidden to keep a reference to the given resolver (including weak references etc.) as well as any type of caching based on values returned from the resolver. Only the resolver itself is capable of determining if results may be cached.

Specified by:
select in interface ITypeSpecifier
Returns:
a resolved type

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getObjectId

public int getObjectId()
Specified by:
getObjectId in interface IObjectSpecifier
Returns:
the ID of this object.

getModifiers

public int getModifiers()
Specified by:
getModifiers in interface IAccessibleInfo
Returns:
access modifiers for the entity
See Also:
Modifier

getSourceFileName

public java.lang.String getSourceFileName()
Description copied from interface: IClassInfo
Returns the name of the source file for this class. Generally, this corresponds to the SourceFile attribute of the relevant class file (as per The Java Virtual Machine Specification, Section 4.7.7).

Specified by:
getSourceFileName in interface IClassInfo
Returns:
the name of the source file, or null if this information is unavailable.

getNumDeclaredStaticFields

public int getNumDeclaredStaticFields()
Specified by:
getNumDeclaredStaticFields in interface IClassInfo
Returns:
the number of declared static fields in this class.

getNumInstanceFields

public int getNumInstanceFields()
Specified by:
getNumInstanceFields in interface IClassInfo
Returns:
the number of instance fields, including all inherited instance fields from super classes.

isDiscarded

public boolean isDiscarded()
Specified by:
isDiscarded in interface IClassInfo
Returns:
true iff the class is known to have been garbage collected.

overrideDefault

public boolean overrideDefault(ValueProperty property,
                               java.lang.Object value)
                        throws java.lang.ClassCastException
Specified by:
overrideDefault in interface IModifyOnce
Returns:
true if the value changed
Throws:
java.lang.ClassCastException


Copyright © 1999, 2011, Oracle and/or its affiliates. All rights reserved.