final class BCELWrapperGenerator
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private class |
BCELWrapperGenerator.BCELClassLoader |
| Modifier and Type | Field and Description |
|---|---|
private BCELWrapperGenerator.BCELClassLoader |
m_bcelClassLoader
The
ClassLoader to use when loading a class generated by this
BCELWrapperGenerator. |
private org.apache.bcel.generic.ClassGen |
m_classGenerator
The
ClassGen instance to use for byte code generation. |
private BCELCodeGenerator |
m_codeGenerator
The
BCELCodeGenerator to use for
byte code generation. |
private org.apache.bcel.util.Repository |
m_repository
The BCEL util.Repository instance to use when loading JavaClass instances.
|
private static java.lang.String |
WRAPPER_CLASS_INTERFACE_NAME
The name of the interface each generated wrapper class has to implement.
|
private static java.lang.String |
WRAPPER_CLASS_SUFFIX
The suffix to be appended to the name of the wrapped class when creating
the name of the wrapper class.
|
private static java.lang.String |
WRAPPER_SUPERCLASS_NAME
The name of the superclass of the wrapper class to be generated.
|
| Constructor and Description |
|---|
BCELWrapperGenerator()
No-args default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private byte[] |
buildWrapper(org.apache.bcel.classfile.JavaClass[] interfacesToImplement)
Generates the wrapper byte code for a given interface.
|
java.lang.Class |
createWrapper(java.lang.Class classToWrap) |
private java.lang.String[] |
extractInterfaceNames(java.lang.Class[] interfaces)
Takes an array of
Class instances supposed to represent
interfaces and returns a list of the names of those interfaces. |
private org.apache.bcel.classfile.JavaClass |
lookupClass(java.lang.Class clazz)
Takes a
Class instance as a its parameter and returns corresponding
the JavaClass instance as used by BCEL. |
private org.apache.bcel.classfile.JavaClass[] |
lookupClasses(java.lang.Class[] classes)
Takes an array of
Class instances and returns an array holding
the corresponding JavaClass instances as used by BCEL. |
private org.apache.bcel.util.Repository m_repository
private static final java.lang.String WRAPPER_CLASS_SUFFIX
private static final java.lang.String WRAPPER_SUPERCLASS_NAME
private static final java.lang.String WRAPPER_CLASS_INTERFACE_NAME
private final BCELCodeGenerator m_codeGenerator
BCELCodeGenerator to use for
byte code generation.private org.apache.bcel.generic.ClassGen m_classGenerator
ClassGen instance to use for byte code generation.private final BCELWrapperGenerator.BCELClassLoader m_bcelClassLoader
ClassLoader to use when loading a class generated by this
BCELWrapperGenerator.public java.lang.Class createWrapper(java.lang.Class classToWrap)
throws java.lang.Exception
java.lang.Exceptionprivate org.apache.bcel.classfile.JavaClass lookupClass(java.lang.Class clazz)
throws java.lang.Exception
Class instance as a its parameter and returns corresponding
the JavaClass instance as used by BCEL.clazz - The Class instance we want to turn into a
JavaClassJavaClass representing the given Class
instancejava.lang.Exceptionprivate org.apache.bcel.classfile.JavaClass[] lookupClasses(java.lang.Class[] classes)
throws java.lang.Exception
Class instances and returns an array holding
the corresponding JavaClass instances as used by BCEL.classes - An array holding Class instances we
want to turn into JavaClass instancesJavaClass instances representing
the given Class instancesjava.lang.Exceptionprivate java.lang.String[] extractInterfaceNames(java.lang.Class[] interfaces)
Class instances supposed to represent
interfaces and returns a list of the names of those interfaces.interfaces - An array of Class instancesClass instancesprivate byte[] buildWrapper(org.apache.bcel.classfile.JavaClass[] interfacesToImplement)
throws java.lang.Exception
interfacesToImplement - The interfaces we want to generate wrapper
byte code forjava.lang.Exception