public interface JavaClass
Modifier and Type | Field and Description |
---|---|
static int |
MODIFIERS_UNAVAILABLE
MODIFIERS_UNAVAILABLE is returned by getModifiers() when the modifiers are unavailable.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares the argument to the receiver, and answers true
if they represent the same object using a class
specific comparison.
|
JavaClassLoader |
getClassLoader()
Fetch the class loader associated with this class.
|
JavaClass |
getComponentType()
For array classes, returns a JavaClass representing the component type of this array class.
|
java.util.Iterator |
getConstantPoolReferences()
Java classes may refer to other classes and to String objects via
the class's constant pool.
|
java.util.Iterator |
getDeclaredFields()
Get the set of fields declared in this class.
|
java.util.Iterator |
getDeclaredMethods()
Get the set of methods declared in this class.
|
ImagePointer |
getID()
The ID of a class is a pointer to a section of memory which identifies
the class.
|
long |
getInstanceSize()
Returns the size in bytes of an instance of this class on the heap.
|
java.util.Iterator |
getInterfaces()
Get the set of names of interfaces directly implemented by this class.
|
int |
getModifiers()
Return the Java language modifiers for this class.
|
java.lang.String |
getName()
Get the name of the class.
|
JavaObject |
getObject()
Fetch the java.lang.Class object associated with this class.
|
JavaObject |
getProtectionDomain()
Returns the protection domain for this class.
|
java.util.Iterator |
getReferences()
Get the set of references from this class.
|
JavaClass |
getSuperclass()
Get the immediate superclass of this class.
|
int |
hashCode()
Answers an integer hash code for the receiver.
|
boolean |
isArray()
Is this an array class ?
|
static final int MODIFIERS_UNAVAILABLE
Modifier
,
Constant Field ValuesJavaObject getObject() throws CorruptDataException
In some implementations this may be null if no object has been created to represent this class, or if the class is synthetic.
CorruptDataException
getID()
JavaClassLoader getClassLoader() throws CorruptDataException
CorruptDataException
- if the class loader for this class cannot
be found (a class cannot exist without a loader so this implies corruption)java.lang.String getName() throws CorruptDataException
CorruptDataException
JavaClass getSuperclass() throws CorruptDataException
CorruptDataException
java.util.Iterator getInterfaces()
String
,
JavaClassLoader.findClass(String)
,
CorruptData
int getModifiers() throws CorruptDataException
The modifiers are defined by the JVM Specification.
Return MODIFIERS_UNAVAILABLE if the modifiers are unavailable. This might be the case if DTFJ is operating against an artefact such as a portable heap dump that does not contain information about a class's modifiers.
Note that, for inner classes, the actual modifiers are returned, not the synthetic modifiers. For instance, a class will never have its 'protected' modifier set, even if the inner class was a protected member, since 'protected' is not a legal modifier for a class file.
CorruptDataException
boolean isArray() throws CorruptDataException
CorruptDataException
JavaClass getComponentType() throws CorruptDataException
CorruptDataException
java.lang.IllegalArgumentException
- if this JavaClass does not represent an array classjava.util.Iterator getDeclaredFields()
JavaField
,
CorruptData
java.util.Iterator getDeclaredMethods()
JavaMethod
,
CorruptData
java.util.Iterator getConstantPoolReferences()
Although Java VMs typically permit only Class and String objects in the constant pool, some esoteric or future virtual machines may permit other types of objects to occur in the constant pool. This API imposes no restrictions on the types of JavaObjects which might be included in the Iterator.
No assumption should be made about the order in which constant pool references are returned.
Classes may also refer to objects through static variables. These may be found with the getDeclaredFields() API. Objects referenced by static variables are not returned by getConstantPoolReferences() unless the object is also referenced by the constant pool.
JavaObject
,
CorruptData
ImagePointer getID()
In some implementations getID() and getObject().getID() may return the same value. This implies that the class object is also the primary internal representation of the class. DTFJ users should not rely on this behaviour.
In some implementations, getID() may return null for some classes. This indicates that the class is a synthetic class which has been constructed for DTFJ purposes only. The class has no physical representation in the VM.
java.util.Iterator getReferences()
JavaReference
,
CorruptData
boolean equals(java.lang.Object obj)
java.lang.Object
equals
in class java.lang.Object
obj
- Object.hashCode()
long getInstanceSize() throws DataUnavailable, CorruptDataException
The call is only meaningful for a non-array JavaClass, where all instances of the class are of the same size. If this method is called on a JavaArrayClass, where instances can be of different sizes, an UnsupportedOperationException will be thrown. DataUnavailable can be thrown if no value is available: for example when DTFJ is examining a javacore, where the instance size for a class is not recorded.
DataUnavailable
CorruptDataException
java.lang.UnsupportedOperationException
- if the JavaClass is an instance of JavaArrayClassint hashCode()
java.lang.Object
true
when passed to
.equals
must answer the same value for this
method.hashCode
in class java.lang.Object
Object.equals(java.lang.Object)
JavaObject getProtectionDomain() throws DataUnavailable, CorruptDataException
DataUnavailable
CorruptDataException
Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 2004, 2023 IBM Corp. and others.