Package org.aspectj.apache.bcel.generic
Class ClassGen
java.lang.Object
org.aspectj.apache.bcel.classfile.Modifiers
org.aspectj.apache.bcel.generic.ClassGen
- All Implemented Interfaces:
Cloneable
Template class for building up a java class. May be initialized with an existing java class.
- Version:
- $Id: ClassGen.java,v 1.15 2009/09/15 19:40:14 aclement Exp $
- Author:
- M. Dahm Upgraded, Andy Clement 9th Mar 06 - calculates SUID
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
addEmptyConstructor
(int access_flags) Convenience method.void
Add a field to this class.void
addInterface
(String name) void
clone()
boolean
containsMethod
(String name, String signature) findsField
(String name) getAttribute
(String attributeName) int
Field[]
String[]
int[]
int
getMajor()
getMethodAt
(int pos) Method[]
int
getMinor()
long
getSUID()
Calculate the SerialVersionUID for a class.int
boolean
hasAttribute
(String attributeName) final boolean
final boolean
isEnum()
void
void
void
removeField
(Field f) void
removeInterface
(String name) void
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) void
setConstantPool
(ConstantPool constant_pool) void
void
setMajor
(int major) void
setMethodAt
(Method method, int pos) void
setMethods
(Method[] methods) void
setMinor
(int minor) void
setSuperclassName
(String name) void
setSuperclassNameIndex
(int superclass_name_index) Methods inherited from class org.aspectj.apache.bcel.classfile.Modifiers
getModifiers, isAbstract, isBridge, isFinal, isInterface, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVarargs, isVolatile, setModifiers
-
Constructor Details
-
ClassGen
public ClassGen(String classname, String superclassname, String filename, int modifiers, String[] interfacenames, ConstantPool cpool) -
ClassGen
-
ClassGen
-
-
Method Details
-
getJavaClass
- Returns:
- build and return a JavaClass
-
addInterface
-
removeInterface
-
getMajor
public int getMajor() -
setMajor
public void setMajor(int major) -
setMinor
public void setMinor(int minor) -
getMinor
public int getMinor() -
addAttribute
-
addAnnotation
-
addMethod
-
addEmptyConstructor
public void addEmptyConstructor(int access_flags) Convenience method. Add an empty constructor to this class that does nothing but calling super().- Parameters:
access
- rights for constructor
-
addField
Add a field to this class.- Parameters:
f
- field to add
-
containsField
-
findsField
- Returns:
- field object with given name, or null if not found
-
containsMethod
- Returns:
- method object with given name and signature, or null if not found
-
removeAttribute
-
removeAnnotation
-
removeMethod
-
replaceMethod
Replace given method with new one. If the old one does not exist add the new_ method to the class anyway. -
replaceField
Replace given field with new one. If the old one does not exist add the new_ field to the class anyway. -
removeField
-
getClassName
-
getSuperclassName
-
getFileName
-
setClassName
-
setSuperclassName
-
getMethods
-
setMethods
-
setFields
-
setMethodAt
-
getMethodAt
-
getInterfaceNames
-
getInterfaces
public int[] getInterfaces() -
getFields
-
getAttributes
-
getAnnotations
-
getConstantPool
-
setConstantPool
-
setClassNameIndex
public void setClassNameIndex(int class_name_index) -
setSuperclassNameIndex
public void setSuperclassNameIndex(int superclass_name_index) -
getSuperclassNameIndex
public int getSuperclassNameIndex() -
getClassNameIndex
public int getClassNameIndex() -
clone
-
isAnnotation
public final boolean isAnnotation() -
isEnum
public final boolean isEnum() -
getSUID
public long getSUID()Calculate the SerialVersionUID for a class. -
hasAttribute
-
getAttribute
-