|
|||||||||
Home >> All >> org >> apache >> bcel >> [ classfile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
org.apache.bcel.classfile
Class JavaClass

java.lang.Objectorg.apache.bcel.classfile.AccessFlags
org.apache.bcel.classfile.JavaClass
- All Implemented Interfaces:
- java.lang.Cloneable, java.lang.Comparable, Node, java.io.Serializable
- public class JavaClass
- extends AccessFlags
- implements java.lang.Cloneable, Node, java.lang.Comparable
- extends AccessFlags
Represents a Java class, i.e., the data structures, constant pool, fields, methods and commands contained in a Java .class file. See JVM specification for details. The intent of this class is to represent a parsed or otherwise existing class file. Those interested in programatically generating classes should see the ClassGen class.
- Version:
- $Id: JavaClass.java 386056 2006-03-15 11:31:56Z tcurdt $
Field Summary | |
private static org.apache.bcel.util.BCELComparator |
_cmp
|
private Attribute[] |
attributes
|
private java.lang.String |
class_name
|
private int |
class_name_index
|
private ConstantPool |
constant_pool
|
(package private) static boolean |
debug
|
private Field[] |
fields
|
static byte |
FILE
|
private java.lang.String |
file_name
|
static byte |
HEAP
|
private java.lang.String[] |
interface_names
|
private int[] |
interfaces
|
private int |
major
|
private Method[] |
methods
|
private int |
minor
|
private java.lang.String |
package_name
|
private org.apache.bcel.util.Repository |
repository
In cases where we go ahead and create something, use the default SyntheticRepository, because we don't know any better. |
(package private) static char |
sep
|
private byte |
source
|
private java.lang.String |
source_file_name
|
private java.lang.String |
superclass_name
|
private int |
superclass_name_index
|
static byte |
ZIP
|
Fields inherited from class org.apache.bcel.classfile.AccessFlags |
access_flags |
Constructor Summary | |
JavaClass(int class_name_index,
int superclass_name_index,
java.lang.String file_name,
int major,
int minor,
int access_flags,
ConstantPool constant_pool,
int[] interfaces,
Field[] fields,
Method[] methods,
Attribute[] attributes)
Constructor gets all contents as arguments. |
|
JavaClass(int class_name_index,
int superclass_name_index,
java.lang.String file_name,
int major,
int minor,
int access_flags,
ConstantPool constant_pool,
int[] interfaces,
Field[] fields,
Method[] methods,
Attribute[] attributes,
byte source)
Constructor gets all contents as arguments. |
Method Summary | |
void |
accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. |
int |
compareTo(java.lang.Object obj)
Return the natural ordering of two JavaClasses. |
JavaClass |
copy()
|
(package private) static void |
Debug(java.lang.String str)
|
void |
dump(java.io.DataOutputStream file)
Dump Java class to output stream in binary format. |
void |
dump(java.io.File file)
Dump class to a file. |
void |
dump(java.io.OutputStream file)
Dump Java class to output stream in binary format. |
void |
dump(java.lang.String _file_name)
Dump class to a file named file_name. |
boolean |
equals(java.lang.Object obj)
Return value as defined by given BCELComparator strategy. |
JavaClass[] |
getAllInterfaces()
Get all interfaces implemented by this JavaClass (transitively). |
Attribute[] |
getAttributes()
|
byte[] |
getBytes()
|
java.lang.String |
getClassName()
|
int |
getClassNameIndex()
|
static org.apache.bcel.util.BCELComparator |
getComparator()
|
ConstantPool |
getConstantPool()
|
Field[] |
getFields()
|
java.lang.String |
getFileName()
|
int[] |
getInterfaceIndices()
|
java.lang.String[] |
getInterfaceNames()
|
JavaClass[] |
getInterfaces()
Get interfaces directly implemented by this JavaClass. |
int |
getMajor()
|
Method |
getMethod(java.lang.reflect.Method m)
|
Method[] |
getMethods()
|
int |
getMinor()
|
java.lang.String |
getPackageName()
|
org.apache.bcel.util.Repository |
getRepository()
Gets the ClassRepository which holds its definition. |
byte |
getSource()
|
java.lang.String |
getSourceFileName()
|
JavaClass |
getSuperClass()
|
JavaClass[] |
getSuperClasses()
|
java.lang.String |
getSuperclassName()
|
int |
getSuperclassNameIndex()
|
int |
hashCode()
Return value as defined by given BCELComparator strategy. |
boolean |
implementationOf(JavaClass inter)
|
private static java.lang.String |
indent(java.lang.Object obj)
|
boolean |
instanceOf(JavaClass super_class)
Equivalent to runtime "instanceof" operator. |
boolean |
isClass()
|
boolean |
isSuper()
|
void |
setAttributes(Attribute[] attributes)
|
void |
setClassName(java.lang.String class_name)
|
void |
setClassNameIndex(int class_name_index)
|
static void |
setComparator(org.apache.bcel.util.BCELComparator comparator)
|
void |
setConstantPool(ConstantPool constant_pool)
|
void |
setFields(Field[] fields)
|
void |
setFileName(java.lang.String file_name)
Set File name of class, aka SourceFile attribute value |
void |
setInterfaceNames(java.lang.String[] interface_names)
|
void |
setInterfaces(int[] interfaces)
|
void |
setMajor(int major)
|
void |
setMethods(Method[] methods)
|
void |
setMinor(int minor)
|
void |
setRepository(org.apache.bcel.util.Repository repository)
Sets the ClassRepository which loaded the JavaClass. |
void |
setSourceFileName(java.lang.String source_file_name)
Set absolute path to file this class was read from. |
void |
setSuperclassName(java.lang.String superclass_name)
|
void |
setSuperclassNameIndex(int superclass_name_index)
|
java.lang.String |
toString()
Convert this Object to a human-readable String. |
Methods inherited from class org.apache.bcel.classfile.AccessFlags |
getAccessFlags, getModifiers, isAbstract, isAbstract, isAnnotation, isAnnotation, isEnum, isEnum, isFinal, isFinal, isInterface, isInterface, isNative, isNative, isPrivate, isPrivate, isProtected, isProtected, isPublic, isPublic, isStatic, isStatic, isStrictfp, isStrictfp, isSynchronized, isSynchronized, isSynthetic, isSynthetic, isTransient, isTransient, isVolatile, isVolatile, setAccessFlags, setModifiers |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
file_name
private java.lang.String file_name
package_name
private java.lang.String package_name
source_file_name
private java.lang.String source_file_name
class_name_index
private int class_name_index
superclass_name_index
private int superclass_name_index
class_name
private java.lang.String class_name
superclass_name
private java.lang.String superclass_name
major
private int major
minor
private int minor
constant_pool
private ConstantPool constant_pool
interfaces
private int[] interfaces
interface_names
private java.lang.String[] interface_names
fields
private Field[] fields
methods
private Method[] methods
attributes
private Attribute[] attributes
source
private byte source
HEAP
public static final byte HEAP
- See Also:
- Constant Field Values
FILE
public static final byte FILE
- See Also:
- Constant Field Values
ZIP
public static final byte ZIP
- See Also:
- Constant Field Values
debug
static boolean debug
sep
static char sep
_cmp
private static org.apache.bcel.util.BCELComparator _cmp
repository
private transient org.apache.bcel.util.Repository repository
- In cases where we go ahead and create something,
use the default SyntheticRepository, because we
don't know any better.
Constructor Detail |
JavaClass
public JavaClass(int class_name_index, int superclass_name_index, java.lang.String file_name, int major, int minor, int access_flags, ConstantPool constant_pool, int[] interfaces, Field[] fields, Method[] methods, Attribute[] attributes, byte source)
- Constructor gets all contents as arguments.
JavaClass
public JavaClass(int class_name_index, int superclass_name_index, java.lang.String file_name, int major, int minor, int access_flags, ConstantPool constant_pool, int[] interfaces, Field[] fields, Method[] methods, Attribute[] attributes)
- Constructor gets all contents as arguments.
Method Detail |
accept
public void accept(Visitor v)
- Called by objects that are traversing the nodes of the tree implicitely
defined by the contents of a Java class. I.e., the hierarchy of methods,
fields, attributes, etc. spawns a tree of objects.
Debug
static final void Debug(java.lang.String str)
dump
public void dump(java.io.File file) throws java.io.IOException
- Dump class to a file.
dump
public void dump(java.lang.String _file_name) throws java.io.IOException
- Dump class to a file named file_name.
getBytes
public byte[] getBytes()
dump
public void dump(java.io.OutputStream file) throws java.io.IOException
- Dump Java class to output stream in binary format.
dump
public void dump(java.io.DataOutputStream file) throws java.io.IOException
- Dump Java class to output stream in binary format.
getAttributes
public Attribute[] getAttributes()
getClassName
public java.lang.String getClassName()
getPackageName
public java.lang.String getPackageName()
getClassNameIndex
public int getClassNameIndex()
getConstantPool
public ConstantPool getConstantPool()
getFields
public Field[] getFields()
getFileName
public java.lang.String getFileName()
getInterfaceNames
public java.lang.String[] getInterfaceNames()
getInterfaceIndices
public int[] getInterfaceIndices()
getMajor
public int getMajor()
getMethods
public Method[] getMethods()
getMethod
public Method getMethod(java.lang.reflect.Method m)
getMinor
public int getMinor()
getSourceFileName
public java.lang.String getSourceFileName()
getSuperclassName
public java.lang.String getSuperclassName()
getSuperclassNameIndex
public int getSuperclassNameIndex()
setAttributes
public void setAttributes(Attribute[] attributes)
setClassName
public void setClassName(java.lang.String class_name)
setClassNameIndex
public void setClassNameIndex(int class_name_index)
setConstantPool
public void setConstantPool(ConstantPool constant_pool)
setFields
public void setFields(Field[] fields)
setFileName
public void setFileName(java.lang.String file_name)
- Set File name of class, aka SourceFile attribute value
setInterfaceNames
public void setInterfaceNames(java.lang.String[] interface_names)
setInterfaces
public void setInterfaces(int[] interfaces)
setMajor
public void setMajor(int major)
setMethods
public void setMethods(Method[] methods)
setMinor
public void setMinor(int minor)
setSourceFileName
public void setSourceFileName(java.lang.String source_file_name)
- Set absolute path to file this class was read from.
setSuperclassName
public void setSuperclassName(java.lang.String superclass_name)
setSuperclassNameIndex
public void setSuperclassNameIndex(int superclass_name_index)
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object
- Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null
, string concatenation will instead use"null"
.The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode())
.
indent
private static final java.lang.String indent(java.lang.Object obj)
copy
public JavaClass copy()
isSuper
public final boolean isSuper()
isClass
public final boolean isClass()
getSource
public final byte getSource()
getRepository
public org.apache.bcel.util.Repository getRepository()
- Gets the ClassRepository which holds its definition. By default
this is the same as SyntheticRepository.getInstance();
setRepository
public void setRepository(org.apache.bcel.util.Repository repository)
- Sets the ClassRepository which loaded the JavaClass.
Should be called immediately after parsing is done.
instanceOf
public final boolean instanceOf(JavaClass super_class) throws java.lang.ClassNotFoundException
- Equivalent to runtime "instanceof" operator.
implementationOf
public boolean implementationOf(JavaClass inter) throws java.lang.ClassNotFoundException
getSuperClass
public JavaClass getSuperClass() throws java.lang.ClassNotFoundException
getSuperClasses
public JavaClass[] getSuperClasses() throws java.lang.ClassNotFoundException
getInterfaces
public JavaClass[] getInterfaces() throws java.lang.ClassNotFoundException
- Get interfaces directly implemented by this JavaClass.
getAllInterfaces
public JavaClass[] getAllInterfaces() throws java.lang.ClassNotFoundException
- Get all interfaces implemented by this JavaClass (transitively).
getComparator
public static org.apache.bcel.util.BCELComparator getComparator()
setComparator
public static void setComparator(org.apache.bcel.util.BCELComparator comparator)
equals
public boolean equals(java.lang.Object obj)
- Return value as defined by given BCELComparator strategy.
By default two JavaClass objects are said to be equal when
their class names are equal.
compareTo
public int compareTo(java.lang.Object obj)
- Return the natural ordering of two JavaClasses.
This ordering is based on the class name
- Specified by:
compareTo
in interfacejava.lang.Comparable
hashCode
public int hashCode()
- Return value as defined by given BCELComparator strategy.
By default return the hashcode of the class name.
|
|||||||||
Home >> All >> org >> apache >> bcel >> [ classfile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |