|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tapestry.enhance.ClassFabricator
Class used to simplify the generation of new classes as a wrapper around BCEL.
Constructor Summary | |
ClassFabricator(String className,
String parentClassName)
Creates a public final class. |
|
ClassFabricator(String className,
String parentClassName,
int accessFlags)
General constructor, creates a new instance using the supplied parameters. |
Method Summary | |
void |
addDefaultConstructor()
Adds a public, no-arguments constructor. |
void |
addField(int accessFlags,
org.apache.bcel.generic.Type type,
String name)
Adds a field with the given access type, type and name. |
void |
addField(org.apache.bcel.generic.Type type,
String name)
Adds a private instance variable of the given type and name. |
void |
addInterface(Class interfaceClass)
|
void |
addInterface(String interfaceName)
Adds an interface to the list of interfaces implemented by the class. |
org.apache.bcel.classfile.JavaClass |
commit()
Invoked very much last, to create the new JavaClass instance. |
MethodFabricator |
createMethod(int accessFlags,
org.apache.bcel.generic.Type returnType,
String methodName)
Creates a new MethodFabricator . |
MethodFabricator |
createMethod(String methodName)
Creates a default public method that returns void. |
String |
getClassName()
Returns the name of the class being fabricated. |
org.apache.bcel.generic.ConstantPoolGen |
getConstantPool()
Returns the mutable constant pool. |
org.apache.bcel.generic.InstructionFactory |
getInstructionFactory()
|
MethodFabricator |
getStaticInitializerMethod()
Returns the static initializer method for the class, creating it if necessary. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ClassFabricator(String className, String parentClassName)
public ClassFabricator(String className, String parentClassName, int accessFlags)
Method Detail |
public MethodFabricator createMethod(int accessFlags, org.apache.bcel.generic.Type returnType, String methodName)
MethodFabricator
. Invoke
MethodFabricator.getInstructionList()
to obtain the (initially empty) instruction list
for the method.
public MethodFabricator createMethod(String methodName)
public void addField(org.apache.bcel.generic.Type type, String name)
public void addField(int accessFlags, org.apache.bcel.generic.Type type, String name)
public void addDefaultConstructor()
public void addInterface(String interfaceName)
public void addInterface(Class interfaceClass)
public org.apache.bcel.generic.InstructionFactory getInstructionFactory()
public org.apache.bcel.classfile.JavaClass commit()
JavaClass
instance.
If there is a
static initializer method
,
then a RETURN
opcode is appended, and the method is committed.
public MethodFabricator getStaticInitializerMethod()
Do not add RETURN
opcodes to the initializer;
it may be accessed by several enhancers, each of which
will need to add some code; putting a RETURN in the middle
will keep some of the initializations from being executed!
commit()
will append a RETURN and commit
the method.
public org.apache.bcel.generic.ConstantPoolGen getConstantPool()
public String getClassName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |