JBoss Reflection 2.2.1.SP1

org.jboss.reflect.plugins.bytecode.accessor
Class MemberAccessorFactory

java.lang.Object
  extended by org.jboss.reflect.plugins.bytecode.accessor.MemberAccessorFactory

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.

Version:
$Revision: 105060 $
Author:
Adrian Brock, Ales Justin, Kabir Khan

Field Summary
static MemberAccessorFactory INSTANCE
           
protected static Class<?> MAGIC_ACCESSOR_IMPL
           
 
Method Summary
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final MemberAccessorFactory INSTANCE

MAGIC_ACCESSOR_IMPL

protected static final Class<?> MAGIC_ACCESSOR_IMPL
Method Detail

addForceGenerate

public void addForceGenerate(String s)

removeForceGenerate

public void removeForceGenerate(String s)

createMethod

public MethodAccessor createMethod(BytecodeMethodInfo info)
                            throws Throwable
Creates a method accessor

This method generates an implementation of JavassistMethod, loads the generated class and instantiates it.

Parameters:
info - the method info
Returns:
the method accessor implementation
Throws:
Throwable - for any error

createConstructor

public ConstructorAccessor createConstructor(BytecodeConstructorInfo info)
                                      throws Throwable
Create a javassist constructor

Parameters:
info - the constructor info
Returns:
the constructor accessor implementation
Throws:
Throwable - for any error

createField

public FieldAccessor createField(BytecodeFieldInfo info)
                          throws Throwable
Create a javassist field

Parameters:
info - the field info
Returns:
the field accessor implementation
Throws:
Throwable - for any error

JBoss Reflection 2.2.1.SP1

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.