public abstract class AbstractProxyFactory extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
FIELD_BEAN_PASSIVATION_ID
The name of the field which stores the passivationID of the Bean this proxy serves.
|
static int |
MAX_CLASSLOAD_TRIES |
protected WebBeansContext |
webBeansContext |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractProxyFactory(WebBeansContext webBeansContext) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
createArrayDefinition(org.apache.xbean.asm4.MethodVisitor mv,
int size,
Class<?> type)
pushes an array of the specified size to the method visitor.
|
protected abstract void |
createConstructor(org.apache.xbean.asm4.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
String classFileName)
Each of our interceptor/decorator proxies has exactly 1 constructor
which invokes the super ct + sets the delegation field.
|
protected abstract void |
createInstanceVariables(org.apache.xbean.asm4.ClassWriter cw,
Class<?> classToProxy,
String classFileName)
generate the bytecode for creating the instance variables of the class
|
protected <T> Class<T> |
createProxyClass(ClassLoader classLoader,
String proxyClassName,
Class<T> classToProxy,
Method[] interceptedMethods,
Method[] nonInterceptedMethods) |
protected abstract void |
createSerialisation(org.apache.xbean.asm4.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
String classFileName)
generate the bytecode for serialization.
|
protected abstract void |
delegateInterceptedMethods(ClassLoader classLoader,
org.apache.xbean.asm4.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
Method[] interceptedMethods)
generate the bytecode for invoking all intercepted methods
|
protected abstract void |
delegateNonInterceptedMethods(ClassLoader classLoader,
org.apache.xbean.asm4.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
Method[] noninterceptedMethods)
generate the bytecode for invoking all non-intercepted methods
|
protected String |
fixPreservedPackages(String proxyClassName) |
protected void |
generateReturn(org.apache.xbean.asm4.MethodVisitor mv,
Method delegatedMethod) |
protected String |
getCastType(Class<?> returnType)
Gets the string to use for CHECKCAST instruction, returning the correct value for any type, including primitives and arrays
|
protected abstract Class |
getMarkerInterface() |
protected String |
getPrimitiveMethod(Class<?> type)
Returns the name of the Java method to call to get the primitive value from an Object - e.g.
|
protected int |
getReturnInsn(Class<?> type)
Gets the appropriate bytecode instruction for RETURN, according to what type we need to return
|
protected String |
getUnusedProxyClassName(ClassLoader classLoader,
String proxyClassName)
Detect a free classname based on the given one
|
protected int |
getVarInsn(Class<?> type)
Returns the appropriate bytecode instruction to load a value from a variable to the stack
|
protected String |
getWrapperType(Class<?> type) |
protected void |
pushIntOntoStack(org.apache.xbean.asm4.MethodVisitor mv,
int i)
Invokes the most appropriate bytecode instruction to put a number on the stack
|
protected void |
pushMethodParameterArray(org.apache.xbean.asm4.MethodVisitor mv,
Class<?>[] parameterTypes)
Create an Object[] parameter which contains all the parameters of the currently invoked method
and store this array for use in the call stack.
|
protected boolean |
unproxyableMethod(Method delegatedMethod) |
protected <T> T |
unsafeNewInstance(Class<T> clazz) |
public static final int MAX_CLASSLOAD_TRIES
protected WebBeansContext webBeansContext
public static final String FIELD_BEAN_PASSIVATION_ID
protected AbstractProxyFactory(WebBeansContext webBeansContext)
protected abstract Class getMarkerInterface()
protected abstract void createInstanceVariables(org.apache.xbean.asm4.ClassWriter cw,
Class<?> classToProxy,
String classFileName)
protected abstract void createSerialisation(org.apache.xbean.asm4.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
String classFileName)
protected abstract void createConstructor(org.apache.xbean.asm4.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
String classFileName)
throws ProxyGenerationException
cw - classToProxy - classFileName - ProxyGenerationExceptionprotected abstract void delegateInterceptedMethods(ClassLoader classLoader, org.apache.xbean.asm4.ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, Method[] interceptedMethods) throws ProxyGenerationException
ProxyGenerationExceptionprotected abstract void delegateNonInterceptedMethods(ClassLoader classLoader, org.apache.xbean.asm4.ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, Method[] noninterceptedMethods) throws ProxyGenerationException
ProxyGenerationExceptionprotected String getUnusedProxyClassName(ClassLoader classLoader, String proxyClassName)
proxyClassName - protected <T> Class<T> createProxyClass(ClassLoader classLoader, String proxyClassName, Class<T> classToProxy, Method[] interceptedMethods, Method[] nonInterceptedMethods) throws ProxyGenerationException
T - classLoader - to use for creating the class inclassToProxy - the class for which a subclass will get generatedinterceptedMethods - the list of intercepted or decorated business methods.nonInterceptedMethods - all methods which are not intercepted nor decorated and shall get delegated directlyProxyGenerationExceptionprotected boolean unproxyableMethod(Method delegatedMethod)
protected String getWrapperType(Class<?> type)
protected int getVarInsn(Class<?> type)
type - Type to loadprotected void pushIntOntoStack(org.apache.xbean.asm4.MethodVisitor mv,
int i)
mv - i - protected int getReturnInsn(Class<?> type)
type - Type the needs to be returnedprotected String getCastType(Class<?> returnType)
returnType - The type to cast to with CHECKCASTprotected String getPrimitiveMethod(Class<?> type)
type - Type whose primitive method we want to lookupprotected void generateReturn(org.apache.xbean.asm4.MethodVisitor mv,
Method delegatedMethod)
protected <T> T unsafeNewInstance(Class<T> clazz)
protected void pushMethodParameterArray(org.apache.xbean.asm4.MethodVisitor mv,
Class<?>[] parameterTypes)
mv - parameterTypes - protected void createArrayDefinition(org.apache.xbean.asm4.MethodVisitor mv,
int size,
Class<?> type)
throws ProxyGenerationException
mv - MethodVisitor to usesize - Size of the array to createtype - Type of array to createProxyGenerationExceptionCopyright © 2008-2013 The Apache Software Foundation. All Rights Reserved.