|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fife.rsta.ac.java.classreader.ClassFile
public class ClassFile
Class representing a ClassFile structure.
| Field Summary | |
|---|---|
static String |
SIGNATURE
|
static String |
SOURCE_FILE
|
| Fields inherited from interface org.fife.rsta.ac.java.classreader.AccessFlags |
|---|
ACC_ABSTRACT, ACC_ANNOTATION, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VOLATILE |
| Constructor Summary | |
|---|---|
ClassFile(DataInputStream in)
|
|
ClassFile(File classFile)
|
|
| Method Summary | |
|---|---|
int |
getAccessFlags()
Returns the access flags for this class or interface. |
AttributeInfo |
getAttribute(int index)
Returns the specified attribute of this class file. |
int |
getAttributeCount()
Returns the number of attributes of this class file. |
String |
getClassName(boolean fullyQualified)
Returns the name of this class or interface. |
protected String |
getClassNameFromConstantPool(int cpIndex,
boolean fullyQualified)
Given an index into the constant pool of a ConstantClassInfo,
this method returns the fully-qualified name of the class it points to. |
int |
getConstantPoolCount()
Returns the size of the constant pool, plus 1. |
ConstantPoolInfo |
getConstantPoolInfo(int index)
Returns the constant pool entry at the specified index. |
int |
getFieldCount()
Returns the number of fields declared in this class file. |
FieldInfo |
getFieldInfo(int index)
Returns the specified field's information. |
int |
getImplementedInterfaceCount()
Returns the number of interfaces this class or interface implements. |
String |
getImplementedInterfaceName(int index,
boolean fullyQualified)
Returns the specified interface implemented by this class or interface. |
int |
getMethodCount()
Returns the number of methods defined/declared in this class or interface. |
MethodInfo |
getMethodInfo(int index)
Returns information about the specified method defined/declared in this class file. |
String |
getPackageName()
Returns the package for this class or interface. |
List |
getParamTypes()
|
String |
getSuperClassName(boolean fullyQualified)
Returns the fully-qualified name of the superclass of this class or interface. |
String |
getTypeArgument(String typeParam)
Returns the currently set type argument for the specified type parameter. |
String |
getUtf8ValueFromConstantPool(int index)
Returns the string value represented by a ConstantUtf8Info
entry in the constant pool. |
String |
getVersionString()
Returns the version number of this class, as a string. |
void |
setTypeParamsToTypeArgs(Map typeMap)
Sets a mapping of type parameters of this class to type arguments for a particular instance of this class. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SIGNATURE
public static final String SOURCE_FILE
| Constructor Detail |
|---|
public ClassFile(File classFile)
throws IOException
IOException
public ClassFile(DataInputStream in)
throws IOException
IOException| Method Detail |
|---|
public int getAccessFlags()
AccessFlagspublic AttributeInfo getAttribute(int index)
index - The index of the attribute.
getAttributeCount()public int getAttributeCount()
getAttribute(int)public String getClassName(boolean fullyQualified)
fullyQualified - Whether the name should be fully-qualified.
getSuperClassName(boolean)
protected String getClassNameFromConstantPool(int cpIndex,
boolean fullyQualified)
ConstantClassInfo,
this method returns the fully-qualified name of the class it points to.
cpIndex - The index into the constant pool. Note that
this value is 1-based.fullyQualified - Whether the returned class name should be fully
qualified.
public int getConstantPoolCount()
1.
1.getConstantPoolInfo(int)public ConstantPoolInfo getConstantPoolInfo(int index)
1-based (that is, valid indices
are 1 - getConstantPoolCount()-1).
index - The index into the constant pool to retrieve.
null if
index is 0 (e.g. this
ClassFile object represents
java.lang.Object).getConstantPoolCount()public int getFieldCount()
getFieldInfo(int)public FieldInfo getFieldInfo(int index)
index - The index of the field info.
public int getImplementedInterfaceCount()
#getImplementedInterfaceName(int)
public String getImplementedInterfaceName(int index,
boolean fullyQualified)
index - The index of the interface.fullyQualified - Whether the returned interface name should be
fully qualified.
getImplementedInterfaceCount()public int getMethodCount()
getMethodInfo(int)public MethodInfo getMethodInfo(int index)
index - The index of the method.
getMethodCount()public String getPackageName()
null if this class or interface
is not in a package.getClassName(boolean)public List getParamTypes()
public String getSuperClassName(boolean fullyQualified)
fullyQualified - Whether the returned value should be fully
qualified.
java.lang.Object" is
returned. If this class file represents
java.lang.Object, then null is
returned.getClassName(boolean)public String getTypeArgument(String typeParam)
typeParam - The type parameter.
Object" if no type
parameters have been set. This is because, if the user types,
say, "java.util.List list;" in Java 5+, the
type defaults to Object. The code completion API
may set the type argument mapping to null if no
type arguments are scanned, thus we need to return
Object in this case.setTypeParamsToTypeArgs(Map)public String getUtf8ValueFromConstantPool(int index)
ConstantUtf8Info
entry in the constant pool.
index - The index into the constant pool of a
ConstantUtf8Info structure. This should be
1-based.
public String getVersionString()
major.minor.public void setTypeParamsToTypeArgs(Map typeMap)
ClassFile
does not directly use this field; it is there for code completion API's
to use to extract the necessary types of arguments, return values, etc.,
of methods (see the MethodInfo class).
typeMap - A mapping of type parameters to type arguments (both
Strings).getTypeArgument(String)public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||