public abstract class GeneratedMemberAccessorFactory extends Object
Abstract base class to create implementations of the MethodAccessor
, ConstructorAccessor
and FieldAccessor
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 ConstructorAccessor |
generateConstructorAccessor(Class<?> superClass,
BytecodeConstructorInfo constructor,
boolean debug)
Creates a new GeneratedConstructor implementation for a given constructor
|
static FieldAccessor |
generateFieldAccessor(Class<?> superClass,
BytecodeFieldInfo field,
boolean debug)
Creates a new GeneratedField implementation for a given field
|
static MethodAccessor |
generateMethodAccessor(Class<?> superClass,
BytecodeMethodInfo method,
boolean debug)
Creates a new GeneratedMethod implementation for a given method
|
protected <T> T |
instantiate(Class<T> clazz)
Instantiates the class
|
protected <T> Class<T> |
makeClass(Class<T> expected,
BytecodeTypeInfo target)
Creates a Method-/Field-/ConstructorAccessor implementation
|
protected static final String OBJECT_NAME
protected static final String[] THROWABLE_EXCEPTIONS
protected static final AtomicInteger counter
public static MethodAccessor generateMethodAccessor(Class<?> superClass, BytecodeMethodInfo method, boolean debug)
superClass
- the super class of the GeneratedMethod implementationmethod
- the BytecodeMethodInfo for which we want to create a GeneratedMethod implementationdebug
- true if the bytecode should be output to fileRuntimeException
- if an error ocurredpublic static ConstructorAccessor generateConstructorAccessor(Class<?> superClass, BytecodeConstructorInfo constructor, boolean debug)
superClass
- the super class of the GeneratedConstructor implementationconstructor
- the BytecodeConstructorInfo for which we want to create a GeneratedConstructor implementationdebug
- true if the bytecode should be output to fileRuntimeException
- if an error ocurredpublic static FieldAccessor generateFieldAccessor(Class<?> superClass, BytecodeFieldInfo field, boolean debug)
superClass
- the super class of the GeneratedField implementationfield
- the BytecodeFieldInfo for which we want to create a GeneratedField 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, BytecodeTypeInfo target)
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.