org.apache.bcel.classfile
public class JavaClass extends AccessFlags implements Cloneable, Node, Comparable
Version: $Id: JavaClass.java 386056 2006-03-15 11:31:56Z tcurdt $
See Also: ClassGen
| Field Summary | |
|---|---|
| Attribute[] | attributes |
| String | class_name |
| int | class_name_index |
| ConstantPool | constant_pool |
| static boolean | debug |
| Field[] | fields |
| String | file_name |
| static byte | FILE |
| static byte | HEAP |
| int[] | interfaces |
| String[] | interface_names |
| int | major |
| Method[] | methods |
| int | minor |
| String | package_name |
| Repository | repository
In cases where we go ahead and create something,
use the default SyntheticRepository, because we
don't know any better. |
| static char | sep |
| byte | source |
| String | source_file_name |
| String | superclass_name |
| int | superclass_name_index |
| static byte | ZIP |
| static BCELComparator | _cmp |
| Constructor Summary | |
|---|---|
| JavaClass(int class_name_index, int superclass_name_index, 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(int class_name_index, int superclass_name_index, 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 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(Object obj)
Return the natural ordering of two JavaClasses.
|
| JavaClass | copy() |
| void | dump(File file)
Dump class to a file.
|
| void | dump(String _file_name)
Dump class to a file named file_name.
|
| void | dump(OutputStream file)
Dump Java class to output stream in binary format.
|
| void | dump(DataOutputStream file)
Dump Java class to output stream in binary format.
|
| static void | Debug(String str) |
| boolean | equals(Object obj)
Return value as defined by given BCELComparator strategy.
|
| JavaClass[] | getAllInterfaces()
Get all interfaces implemented by this JavaClass (transitively). |
| Attribute[] | getAttributes() |
| byte[] | getBytes() |
| String | getClassName() |
| int | getClassNameIndex() |
| static BCELComparator | getComparator() |
| ConstantPool | getConstantPool() |
| Field[] | getFields() |
| String | getFileName() |
| int[] | getInterfaceIndices() |
| String[] | getInterfaceNames() |
| JavaClass[] | getInterfaces()
Get interfaces directly implemented by this JavaClass. |
| int | getMajor() |
| Method | getMethod(Method m) |
| Method[] | getMethods() |
| int | getMinor() |
| String | getPackageName() |
| Repository | getRepository()
Gets the ClassRepository which holds its definition. |
| byte | getSource() |
| String | getSourceFileName() |
| String | getSuperclassName() |
| int | getSuperclassNameIndex() |
| JavaClass | getSuperClass() |
| JavaClass[] | getSuperClasses() |
| int | hashCode()
Return value as defined by given BCELComparator strategy.
|
| boolean | implementationOf(JavaClass inter) |
| static String | indent(Object obj) |
| boolean | instanceOf(JavaClass super_class) Equivalent to runtime "instanceof" operator.
|
| boolean | isClass() |
| boolean | isSuper() |
| void | setAttributes(Attribute[] attributes) |
| void | setClassName(String class_name) |
| void | setClassNameIndex(int class_name_index) |
| static void | setComparator(BCELComparator comparator) |
| void | setConstantPool(ConstantPool constant_pool) |
| void | setFields(Field[] fields) |
| void | setFileName(String file_name)
Set File name of class, aka SourceFile attribute value |
| void | setInterfaceNames(String[] interface_names) |
| void | setInterfaces(int[] interfaces) |
| void | setMajor(int major) |
| void | setMethods(Method[] methods) |
| void | setMinor(int minor) |
| void | setRepository(Repository repository)
Sets the ClassRepository which loaded the JavaClass.
|
| void | setSourceFileName(String source_file_name)
Set absolute path to file this class was read from. |
| void | setSuperclassName(String superclass_name) |
| void | setSuperclassNameIndex(int superclass_name_index) |
| String | toString() |
Parameters: class_name_index Index into constant pool referencing a ConstantClass that represents this class. superclass_name_index Index into constant pool referencing a ConstantClass that represents this class's superclass. file_name File name major Major compiler version minor Minor compiler version access_flags Access rights defined by bit flags constant_pool Array of constants interfaces Implemented interfaces fields Class fields methods Class methods attributes Class attributes source Read from file or generated in memory?
Parameters: class_name_index Class name superclass_name_index Superclass name file_name File name major Major compiler version minor Minor compiler version access_flags Access rights defined by bit flags constant_pool Array of constants interfaces Implemented interfaces fields Class fields methods Class methods attributes Class attributes
Parameters: v Visitor object
Returns: deep copy of this class
Parameters: file Output file
Throws: IOException
Parameters: _file_name Output file name
Throws: IOException
Parameters: file Output stream
Throws: IOException
Parameters: file Output stream
Throws: IOException
See Also: java.lang.Object#equals(java.lang.Object)
Returns: Attributes of the class.
Returns: class in binary format
Returns: Class name.
Returns: Class name index.
Returns: Comparison strategy object
Returns: Constant pool.
Returns: Fields, i.e., variables of the class. Like the JVM spec mandates for the classfile format, these fields are those specific to this class, and not those of the superclass or superinterfaces.
Returns: File name of class, aka SourceFile attribute value
Returns: Indices in constant pool of implemented interfaces.
Returns: Names of implemented interfaces.
Returns: Major number of class file version.
Returns: A org.apache.bcel.classfile.Method corresponding to java.lang.reflect.Method if any
Returns: Methods of the class.
Returns: Minor number of class file version.
Returns: Package name.
Returns: returns either HEAP (generated), FILE, or ZIP
Returns: sbsolute path to file where this class was read from
Returns: Superclass name.
Returns: Class name index.
Returns: the superclass for this JavaClass object, or null if this is java.lang.Object
Throws: ClassNotFoundException if the superclass can't be found
Returns: list of super classes of this class in ascending order, i.e., java.lang.Object is always the last element
Throws: ClassNotFoundException if any of the superclasses can't be found
See Also: java.lang.Object#hashCode()
Returns: true, if this class is an implementation of interface inter
Throws: ClassNotFoundException if superclasses or superinterfaces of this class can't be found
Returns: true if this JavaClass is derived from the super class
Throws: ClassNotFoundException if superclasses or superinterfaces of this object can't be found
Parameters: attributes .
Parameters: class_name .
Parameters: class_name_index .
Parameters: comparator Comparison strategy object
Parameters: constant_pool .
Parameters: fields .
Parameters: interface_names .
Parameters: interfaces .
Parameters: major .
Parameters: methods .
Parameters: minor .
Parameters: superclass_name .
Parameters: superclass_name_index .
Returns: String representing class contents.