public abstract class JavassistMemberFactory extends Object
Abstract base class to create implementations of the JavassistMethod
, JavassistConstructor
and JavassistField
interfaces.
This implementation generates raw bytecode to avoid the overhead of compilation via javassist. If
sun.reflect.MagicAccessorImpl
is used as the superClass
field the implementation
classes can access private and protected members of the target class.
Modifier and Type | Field and Description |
---|---|
protected static AtomicInteger |
counter
The method class counter
|
protected static String |
OBJECT_NAME
Object class name
|
protected static String[] |
THROWABLE_EXCEPTIONS
Array of exceptions containing jvm name of Throwable
|
Modifier and Type | Method and Description |
---|---|
static JavassistConstructor |
createJavassistConstructor(Class<?> superClass,
JavassistConstructorInfo constructor,
boolean debug)
Creates a new JavassistConstructor implementation for a given constructor
|
static JavassistField |
createJavassistField(Class<?> superClass,
JavassistFieldInfo field,
boolean debug)
Creates a new JavassistField implementation for a given field
|
static JavassistMethod |
createJavassistMethod(Class<?> superClass,
JavassistMethodInfo method,
boolean debug)
Creates a new JavassistMethod implementation for a given method
|
protected <T> T |
instantiate(Class<T> clazz)
Instantiates the class
|
protected <T> Class<T> |
makeClass(Class<T> expected,
JavassistTypeInfo target)
Creates a JavassistMethod/-Field/-Constructor implementation
|
protected static final String OBJECT_NAME
protected static final String[] THROWABLE_EXCEPTIONS
protected static final AtomicInteger counter
public static JavassistMethod createJavassistMethod(Class<?> superClass, JavassistMethodInfo method, boolean debug)
superClass
- the super class of the JavassistMethod implementationmethod
- the JavassistMethodInfo for which we want to create a JavassistMethod implementationdebug
- true if the bytecode should be output to fileRuntimeException
- if an error ocurredpublic static JavassistConstructor createJavassistConstructor(Class<?> superClass, JavassistConstructorInfo constructor, boolean debug)
superClass
- the super class of the JavassistConstructor implementationconstructor
- the JavassistConstructorInfo for which we want to create a JavassistConstructor implementationdebug
- true if the bytecode should be output to fileRuntimeException
- if an error ocurredpublic static JavassistField createJavassistField(Class<?> superClass, JavassistFieldInfo field, boolean debug)
superClass
- the super class of the JavassistField implementationfield
- the JavassistFieldInfo for which we want to create a JavassistField implementationdebug
- true if the bytecode should be output to fileRuntimeException
- if an error ocurredprotected <T> T instantiate(Class<T> clazz)
clazz
- the classRuntimeException
- if an error ocurredprotected <T> Class<T> makeClass(Class<T> expected, JavassistTypeInfo target)
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.