org.apache.bcel.generic
public class ClassGen extends AccessFlags implements Cloneable
See Also: JavaClass
Constructor Summary | |
---|---|
ClassGen(String class_name, String super_class_name, String file_name, int access_flags, String[] interfaces, ConstantPoolGen cp) Convenience constructor to set up some important values initially.
| |
ClassGen(String class_name, String super_class_name, String file_name, int access_flags, String[] interfaces) Convenience constructor to set up some important values initially.
| |
ClassGen(JavaClass clazz)
Initialize with existing class. |
Method Summary | |
---|---|
void | addAttribute(Attribute a)
Add an attribute to this class. |
void | addEmptyConstructor(int access_flags)
Convenience method.
|
void | addField(Field f)
Add a field to this class. |
void | addInterface(String name)
Add an interface to this class, i.e., this class has to implement it. |
void | addMethod(Method m)
Add a method to this class. |
void | addObserver(ClassObserver o) Add observer for this object. |
Object | clone() |
boolean | containsField(Field f) |
Field | containsField(String name) |
Method | containsMethod(String name, String signature) |
boolean | equals(Object obj)
Return value as defined by given BCELComparator strategy.
|
Attribute[] | getAttributes() |
String | getClassName() |
int | getClassNameIndex() |
static BCELComparator | getComparator() |
ConstantPoolGen | getConstantPool() |
Field[] | getFields() |
String | getFileName() |
String[] | getInterfaceNames() |
int[] | getInterfaces() |
JavaClass | getJavaClass() |
int | getMajor() |
Method | getMethodAt(int pos) |
Method[] | getMethods() |
int | getMinor() |
String | getSuperclassName() |
int | getSuperclassNameIndex() |
int | hashCode()
Return value as defined by given BCELComparator strategy.
|
void | removeAttribute(Attribute a)
Remove an attribute from this class. |
void | removeField(Field f)
Remove a field to this class. |
void | removeInterface(String name)
Remove an interface from this class. |
void | removeMethod(Method m)
Remove a method from this class. |
void | removeObserver(ClassObserver o) Remove observer for this object. |
void | replaceField(Field old, Field new_) Replace given field with new one. |
void | replaceMethod(Method old, Method new_) Replace given method with new one. |
void | setClassName(String name) |
void | setClassNameIndex(int class_name_index) |
static void | setComparator(BCELComparator comparator) |
void | setConstantPool(ConstantPoolGen constant_pool) |
void | setMajor(int major) Set major version number of class file, default value is 45 (JDK 1.1) |
void | setMethodAt(Method method, int pos) |
void | setMethods(Method[] methods) |
void | setMinor(int minor) Set minor version number of class file, default value is 3 (JDK 1.1) |
void | setSuperclassName(String name) |
void | setSuperclassNameIndex(int superclass_name_index) |
void | update() Call notify() method on all observers. |
Parameters: class_name fully qualified class name super_class_name fully qualified superclass name file_name source file name access_flags access qualifiers interfaces implemented interfaces cp constant pool to use
Parameters: class_name fully qualified class name super_class_name fully qualified superclass name file_name source file name access_flags access qualifiers interfaces implemented interfaces
Parameters: clazz JavaClass object (e.g. read from file)
Parameters: a attribute to add
Parameters: access_flags rights for constructor
Parameters: f field to add
Parameters: name interface to implement (fully qualified class name)
Parameters: m method to add
Returns: field object with given name, or null
Returns: method object with given name and signature, or null
See Also: java.lang.Object#equals(java.lang.Object)
Returns: Comparison strategy object
Returns: the (finally) built up Java class object.
Returns: major version number of class file
Returns: minor version number of class file
See Also: java.lang.Object#hashCode()
Parameters: a attribute to remove
Parameters: f field to remove
Parameters: name interface to remove (fully qualified name)
Parameters: m method to remove
Parameters: comparator Comparison strategy object
Parameters: major major version number
Parameters: minor minor version number