Package org.eclipse.jdt.core.util
Interface IClassFileReader
public interface IClassFileReader
Description of a .class file. This class reifies the internal structure of a .class
file following the JVM specifications.
Note that several changes were introduced with J2SE 1.5. Class file reader implementations should use support these new class file attributes by returning objects implementing the appropriate specialized attribute interfaces. Class file reader clients can search for these new attributes and downcast to the new interfaces as appropriate.
This interface may be implemented by clients.- Since:
- 2.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
This value should be used to read completely each part of a .class file.static final int
This value should be used to read the whole contents of the .class file except the method bodies.static final int
This value should be used to read the constant pool entries and the attributes of a .class file.static final int
This value should be used to read only the constant pool entries of a .class file.static final int
This value should be used to read the constant pool entries and the field infos of a .class file.static final int
This value should be used to read the method bodies.static final int
This value should be used to read the constant pool entries and the method infos of a .class file.static final int
This value should be used to read the constant pool entries and the super interface names of a .class file. -
Method Summary
Modifier and TypeMethodDescriptionint
Answer back the access flags of the .class file.int
Answer back the attribute number of the .class file.Answer back the collection of all attributes of the field info.int
Answer back the index of the class name in the constant pool of the .class file.char[]
Answer back the qualified name of the .class file.Answer the constant pool of this .class file.Answer back the array of field infos of the .class file, an empty array if none.int
Answer back the number of field infos.Answer back the inner classes attribute of this .class file, null if none.int[]
Answer back the indexes in the constant pool of interfaces implemented by this .class file, an empty array if none.char[][]
Answer back the names of interfaces implemented by this .class file, an empty array if none.int
getMagic()
Answer back the magic number.int
Answer the major version of this .class file.Answer back the array of method infos of this .class file, an empty array if none.int
Answer back the number of method infos.int
Answer the minor version of this .class file.default INestMembersAttribute
Answer back the nest members attribute of this .class file, null if none.default IPermittedSubclassesAttribute
Answer back the permitted subclasses attribute of this .class file, null if none.default IRecordAttribute
Answer back the record attribute of this .class file, null if none.Answer the source file attribute, if it exists, null otherwise.int
Answer back the index of the superclass name in the constant pool of the .class file.char[]
Answer back the qualified name of the superclass of this .class file.boolean
isClass()
Answer true if this .class file represents a class, false otherwise.boolean
Answer true if this .class file represents an interface, false otherwise.
-
Field Details
-
ALL
static final int ALLThis value should be used to read completely each part of a .class file.- See Also:
-
CONSTANT_POOL
static final int CONSTANT_POOLThis value should be used to read only the constant pool entries of a .class file.- See Also:
-
METHOD_INFOS
static final int METHOD_INFOSThis value should be used to read the constant pool entries and the method infos of a .class file.- See Also:
-
FIELD_INFOS
static final int FIELD_INFOSThis value should be used to read the constant pool entries and the field infos of a .class file.- See Also:
-
SUPER_INTERFACES
static final int SUPER_INTERFACESThis value should be used to read the constant pool entries and the super interface names of a .class file.- See Also:
-
CLASSFILE_ATTRIBUTES
static final int CLASSFILE_ATTRIBUTESThis value should be used to read the constant pool entries and the attributes of a .class file.- See Also:
-
METHOD_BODIES
static final int METHOD_BODIESThis value should be used to read the method bodies. It has to be used with METHOD_INFOS.- See Also:
-
ALL_BUT_METHOD_BODIES
static final int ALL_BUT_METHOD_BODIESThis value should be used to read the whole contents of the .class file except the method bodies.- See Also:
-
-
Method Details
-
getAccessFlags
int getAccessFlags()Answer back the access flags of the .class file.- Returns:
- the access flags of the .class file
-
getFieldInfos
IFieldInfo[] getFieldInfos()Answer back the array of field infos of the .class file, an empty array if none.- Returns:
- the array of field infos of the .class file, an empty array if none
-
getInterfaceNames
char[][] getInterfaceNames()Answer back the names of interfaces implemented by this .class file, an empty array if none. The names are returned as described in the JVM specifications.- Returns:
- the names of interfaces implemented by this .class file, an empty array if none
-
getInterfaceIndexes
int[] getInterfaceIndexes()Answer back the indexes in the constant pool of interfaces implemented by this .class file, an empty array if none.- Returns:
- the indexes in the constant pool of interfaces implemented by this .class file, an empty array if none
-
getInnerClassesAttribute
IInnerClassesAttribute getInnerClassesAttribute()Answer back the inner classes attribute of this .class file, null if none.- Returns:
- the inner classes attribute of this .class file, null if none
-
getNestMembersAttribute
Answer back the nest members attribute of this .class file, null if none.- Returns:
- the nest members attribute of this .class file, null if none
- Since:
- 3.16
-
getRecordAttribute
Answer back the record attribute of this .class file, null if none.- Returns:
- the nest record of this .class file, null if none
- Since:
- 3.22
-
getPermittedSubclassesAttribute
Answer back the permitted subclasses attribute of this .class file, null if none.- Returns:
- the permitted subclasses attribute of this .class file, null if none
- Since:
- 3.24
-
getMethodInfos
IMethodInfo[] getMethodInfos()Answer back the array of method infos of this .class file, an empty array if none.- Returns:
- the array of method infos of this .class file, an empty array if none
-
getClassName
char[] getClassName()Answer back the qualified name of the .class file. The name is returned as described in the JVM specifications.- Returns:
- the qualified name of the .class file
-
getClassIndex
int getClassIndex()Answer back the index of the class name in the constant pool of the .class file.- Returns:
- the index of the class name in the constant pool
-
getSuperclassName
char[] getSuperclassName()Answer back the qualified name of the superclass of this .class file. The name is returned as described in the JVM specifications. Answer null if getSuperclassIndex() is zero.- Returns:
- the qualified name of the superclass of this .class file, null if getSuperclassIndex() is zero
-
getSuperclassIndex
int getSuperclassIndex()Answer back the index of the superclass name in the constant pool of the .class file. Answer 0 if this .class file represents java.lang.Object.- Returns:
- the index of the superclass name in the constant pool of the .class file, 0 if this .class file represents java.lang.Object.
-
isClass
boolean isClass()Answer true if this .class file represents a class, false otherwise.- Returns:
- true if this .class file represents a class, false otherwise
-
isInterface
boolean isInterface()Answer true if this .class file represents an interface, false otherwise.- Returns:
- true if this .class file represents an interface, false otherwise
-
getSourceFileAttribute
ISourceAttribute getSourceFileAttribute()Answer the source file attribute, if it exists, null otherwise.- Returns:
- the source file attribute, if it exists, null otherwise
-
getConstantPool
IConstantPool getConstantPool()Answer the constant pool of this .class file.- Returns:
- the constant pool of this .class file
-
getMinorVersion
int getMinorVersion()Answer the minor version of this .class file.- Returns:
- the minor version of this .class file
-
getMajorVersion
int getMajorVersion()Answer the major version of this .class file.- Returns:
- the major version of this .class file
-
getAttributeCount
int getAttributeCount()Answer back the attribute number of the .class file.- Returns:
- the attribute number of the .class file
-
getAttributes
IClassFileAttribute[] getAttributes()Answer back the collection of all attributes of the field info. It includes SyntheticAttribute, ConstantValueAttributes, etc. Answers an empty array if none.- Returns:
- the collection of all attributes of the field info. It includes SyntheticAttribute, ConstantValueAttributes, etc. Answers an empty array if none
-
getMagic
int getMagic()Answer back the magic number.- Returns:
- the magic number
-
getFieldsCount
int getFieldsCount()Answer back the number of field infos.- Returns:
- the number of field infos
-
getMethodsCount
int getMethodsCount()Answer back the number of method infos.- Returns:
- the number of method infos
-