|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.avalon.fortress.impl.factory.BCELCodeGenerator
BCELCodeGenerator creates implementations for the Methods and Fields needed in creating a WrapperClass.
| Nested Class Summary | |
private static class |
BCELCodeGenerator.MethodDesc |
| Field Summary | |
private static java.lang.String |
ACCESSOR_METHOD_NAMEThe name of the field accessor used to ask the generated wrapper for the wrapped class instance. |
private ClassGen |
m_classGeneratorThe ClassGen instance to use for code generation. |
private JavaClass |
m_classToWrapClass object holding the type of the object we want to create a wrapper for. |
private Type |
m_classToWrapTypeThe Type of the class we want to create a wrapper for. |
private ConstantPoolGen |
m_constPoolGeneratorThe ConstantPoolGen instance to use for code generation. |
private InstructionFactory |
m_instructionFactoryThe InstructionFactory to use during code gereration. |
private InstructionList |
m_instructionListThe InstructionList instance to use during code generation. |
private boolean |
m_isInitializedFlag indicating whether this instance is already initialized or not. |
private java.lang.String |
m_wrapperClassNameThe name of the wrapper class to be created. |
private java.lang.String |
m_wrapperSuperclassNameThe name of the superclass of the wrapper class to be generated. |
private static java.lang.String |
WRAPPED_CLASS_FNThe name of the field holding the wrapped class in the generated wrapper, e.g. |
| Constructor Summary | |
BCELCodeGenerator()Default constructor. |
|
| Method Summary | |
Method |
createDefaultConstructor()Create the wrapper class' default constructor: |
Method[] |
createImplementation(JavaClass[] interfacesToImplement)Creates an implementation for the supplied JavaClass instance representing an interface. |
Method |
createMethodWrapper(BCELCodeGenerator.MethodDesc meth)Create a method declaration/definition of the form |
Method |
createWrappedClassAccessor()Create a field accessor for the wrapped class instance of the form |
Field |
createWrappedClassField()Create a field declaration of the form |
private Method |
extractMethod(MethodGen mg)Extracts the Method out of the supplied MethodGen instance, clears the InstructionList and returns the extracted Method. |
(package private) static BCELCodeGenerator.MethodDesc[] |
extractMethods(JavaClass[] interfacesToImplement)Extracts the collection of Methods declared in the supplied JavaClass instance. |
private static void |
extractMethods(JavaClass interfaceToImplement, java.util.Set methods) |
private void |
findImplementation(BCELCodeGenerator.MethodDesc meth) |
void |
init(java.lang.String wrapperClassName, java.lang.String wrapperSuperclassName, JavaClass classToWrap, ClassGen classGenerator) |
private boolean |
isInitialized()Has this instance already been initialized? |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final java.lang.String WRAPPED_CLASS_FN
private final WRAPPED_CLASS_FN;
private static final java.lang.String ACCESSOR_METHOD_NAME
private java.lang.String m_wrapperClassName
private java.lang.String m_wrapperSuperclassName
private JavaClass m_classToWrap
private Type m_classToWrapType
Type of the class we want to create a wrapper for.
private ClassGen m_classGenerator
ClassGen instance to use for code generation.
private ConstantPoolGen m_constPoolGenerator
ConstantPoolGen instance to use for code generation.
private final InstructionList m_instructionList
InstructionList instance to use during code generation.
private InstructionFactory m_instructionFactory
InstructionFactory to use during code gereration.
private boolean m_isInitialized
| Constructor Detail |
public BCELCodeGenerator()
| Method Detail |
public void init(java.lang.String wrapperClassName,
java.lang.String wrapperSuperclassName,
JavaClass classToWrap,
ClassGen classGenerator)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public Field createWrappedClassField()
throws java.lang.IllegalStateException
private WRAPPED_CLASS_FN;
java.lang.IllegalStateException - If this instance is not initialized.
public Method createDefaultConstructor()
throws java.lang.IllegalStateException
public ( classToWrap)
{
this. = classToWrap;
}
java.lang.IllegalStateException - If this instance is not initialized.
public Method createWrappedClassAccessor()
throws java.lang.IllegalStateException
public Object ()
{
return this.;
}
java.lang.IllegalStateException
public Method createMethodWrapper(BCELCodeGenerator.MethodDesc meth)
throws java.lang.IllegalArgumentException,
java.lang.IllegalStateException
public ()
throws
{
return this..();
}
meth - The method descriptorMethod object representing the created methodjava.lang.IllegalArgumentException - If any of the parameters passed in is null.java.lang.IllegalStateException - If this instance is not initialized.private void findImplementation(BCELCodeGenerator.MethodDesc meth)
public Method[] createImplementation(JavaClass[] interfacesToImplement)
throws java.lang.Exception
JavaClass instance representing an interface.
interfacesToImplement - The interfaces we want to create an implementation forMethod instances representing the interface implementation.java.lang.IllegalArgumentException - If interfaceToImplement is null or does not represent an interfacejava.lang.IllegalStateException - If this instance has not been initializedjava.lang.Exceptionprivate Method extractMethod(MethodGen mg)
Method out of the supplied MethodGen instance, clears the InstructionList and returns the extracted Method.
mg - The MethodGen instance holding the Method to extractMethodprivate boolean isInitialized()
static BCELCodeGenerator.MethodDesc[] extractMethods(JavaClass[] interfacesToImplement)
throws java.lang.Exception
Methods declared in the supplied JavaClass instance. This instance is supposed to represent an interface.
interfacesToImplement - The JavaClass instances representing the interfaces we are asking for its methods.Methods declared by the interfacejava.lang.IllegalArgumentException - If interfaceToImplement does not represent an interfacejava.lang.NullPointerException - if the interfaceToImplement is nulljava.lang.Exception
private static final void extractMethods(JavaClass interfaceToImplement,
java.util.Set methods)
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||