public class MemberAccessorFactory extends Object
BytecodeReflectionFactory.
Creates instances of MethodAccessor
, ConstructorAccessor
and
FieldAccessor
that invoke methods, constructors, and accesses fields without
the use of reflection. Although a lot faster, there is an overhead associated with generating
these classes, so they should only be used for frequently used members
To output the generated classes to disk, so the bytecode can be inspected, specify
-Dorg.jboss.reflect.plugins.bytecode.BytecodeReflectionFactory.debug=true
.
To enable metrics, which can be useful in determining which members accessors should be generated, specify
-Dorg.jboss.reflect.plugins.javassist.BytecodeReflectionFactory.enableMetrics=true
.
Modifier and Type | Field and Description |
---|---|
static MemberAccessorFactory |
INSTANCE |
protected static Class<?> |
MAGIC_ACCESSOR_IMPL |
Modifier and Type | Method and Description |
---|---|
void |
addForceGenerate(String s) |
ConstructorAccessor |
createConstructor(BytecodeConstructorInfo info)
Create a javassist constructor
|
FieldAccessor |
createField(BytecodeFieldInfo info)
Create a javassist field
|
MethodAccessor |
createMethod(BytecodeMethodInfo info)
Creates a method accessor
|
void |
removeForceGenerate(String s) |
public static final MemberAccessorFactory INSTANCE
protected static final Class<?> MAGIC_ACCESSOR_IMPL
public void addForceGenerate(String s)
public void removeForceGenerate(String s)
public MethodAccessor createMethod(BytecodeMethodInfo info) throws Throwable
This method generates an implementation of JavassistMethod
, loads
the generated class and instantiates it.
info
- the method infoThrowable
- for any errorpublic ConstructorAccessor createConstructor(BytecodeConstructorInfo info) throws Throwable
info
- the constructor infoThrowable
- for any errorpublic FieldAccessor createField(BytecodeFieldInfo info) throws Throwable
info
- the field infoThrowable
- for any errorCopyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.