public class JavassistReflectionFactory extends Object
JavassistReflectionFactory.
Creates instances of JavassistMethod
, JavassistConstructor
and
JavassistField
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.javassist.JavassistReflectionFactory.debug=true
.
To enable metrics, which can be useful in determining which members accessors should be generated, specify
-Dorg.jboss.reflect.plugins.javassist.JavassistReflectionFactory.enableMetrics=true
.
Modifier and Type | Field and Description |
---|---|
static JavassistReflectionFactory |
INSTANCE |
protected static Class<?> |
MAGIC_ACCESSOR_IMPL |
Modifier and Type | Method and Description |
---|---|
void |
addForceGenerate(String s) |
JavassistConstructor |
createConstructor(JavassistConstructorInfo info)
Create a javassist constructor
|
JavassistField |
createField(JavassistFieldInfo info)
Create a javassist field
|
JavassistMethod |
createMethod(JavassistMethodInfo info)
Creates a javassist method.
|
void |
removeForceGenerate(String s) |
public static final JavassistReflectionFactory INSTANCE
protected static final Class<?> MAGIC_ACCESSOR_IMPL
public void addForceGenerate(String s)
public void removeForceGenerate(String s)
public JavassistMethod createMethod(JavassistMethodInfo info) throws Throwable
JavassistMethod
, loads
the generated class and instantiates it.ctMethod
- the methodThrowable
- for any errorpublic JavassistConstructor createConstructor(JavassistConstructorInfo info) throws Throwable
ctConstructor
- the constructorThrowable
- for any errorpublic JavassistField createField(JavassistFieldInfo info) throws Throwable
ctField
- the fieldThrowable
- for any errorCopyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.