public class InterceptorDecoratorProxyFactory extends AbstractProxyFactory
| Modifier and Type | Field and Description |
|---|---|
static String |
FIELD_INTERCEPTED_METHODS
the name of the field which stores the Method[] of all intercepted methods
|
static String |
FIELD_INTERCEPTOR_HANDLER
the name of the field which stores the Interceptor + Decorator stack InterceptorHandler
|
static String |
FIELD_PROXIED_INSTANCE
the name of the field which stores the proxied instance
|
FIELD_BEAN_PASSIVATION_ID, MAX_CLASSLOAD_TRIES, webBeansContext| Constructor and Description |
|---|
InterceptorDecoratorProxyFactory(WebBeansContext webBeansContext) |
| Modifier and Type | Method and Description |
|---|---|
protected 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 void |
createInstanceVariables(org.apache.xbean.asm4.ClassWriter cw,
Class<?> classToProxy,
String classFileName)
generate the bytecode for creating the instance variables of the class
|
<T> Class<T> |
createProxyClass(javax.enterprise.inject.spi.Bean<T> bean,
ClassLoader classLoader,
Class<T> classToProxy,
Method[] interceptedMethods,
Method[] nonInterceptedMethods)
Create a decorator and interceptor proxy for the given type.
|
<T> T |
createProxyInstance(Class<? extends T> proxyClass,
T instance,
InterceptorHandler interceptorDecoratorStack) |
protected void |
createSerialisation(org.apache.xbean.asm4.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
String classFileName)
generate the bytecode for serialization.
|
protected 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 void |
delegateNonInterceptedMethods(ClassLoader classLoader,
org.apache.xbean.asm4.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
Method[] noninterceptedMethods)
Directly delegate all non intercepted nor decorated methods to the internal instance.
|
<T> Class<T> |
getCachedProxyClass(javax.enterprise.inject.spi.Bean<T> bean) |
InterceptorHandler |
getInterceptorHandler(OwbInterceptorProxy proxyInstance) |
protected Class |
getMarkerInterface() |
static <T> T |
unwrapInstance(T proxyInstance) |
createArrayDefinition, createProxyClass, fixPreservedPackages, generateReturn, getCastType, getPrimitiveMethod, getReturnInsn, getUnusedProxyClassName, getVarInsn, getWrapperType, pushIntOntoStack, pushMethodParameterArray, unproxyableMethod, unsafeNewInstancepublic static final String FIELD_PROXIED_INSTANCE
public static final String FIELD_INTERCEPTOR_HANDLER
public static final String FIELD_INTERCEPTED_METHODS
public InterceptorDecoratorProxyFactory(WebBeansContext webBeansContext)
public <T> T createProxyInstance(Class<? extends T> proxyClass, T instance, InterceptorHandler interceptorDecoratorStack) throws ProxyGenerationException
ProxyGenerationExceptionpublic static <T> T unwrapInstance(T proxyInstance)
public InterceptorHandler getInterceptorHandler(OwbInterceptorProxy proxyInstance)
public <T> Class<T> createProxyClass(javax.enterprise.inject.spi.Bean<T> bean, ClassLoader classLoader, Class<T> classToProxy, Method[] interceptedMethods, Method[] nonInterceptedMethods) throws ProxyGenerationException
Create a decorator and interceptor proxy for the given type. A single instance of such a proxy class has exactly one single internal instance.
There are 3 different kind of methods:
unwrapInstance(Object) and use reflection on it.
T - bean - the bean the proxy serves for. Needed for caching and serialisation.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 directlyProxyGenerationExceptionpublic <T> Class<T> getCachedProxyClass(javax.enterprise.inject.spi.Bean<T> bean)
protected Class getMarkerInterface()
getMarkerInterface in class AbstractProxyFactoryprotected void createInstanceVariables(org.apache.xbean.asm4.ClassWriter cw,
Class<?> classToProxy,
String classFileName)
AbstractProxyFactorycreateInstanceVariables in class AbstractProxyFactoryprotected void createSerialisation(org.apache.xbean.asm4.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
String classFileName)
AbstractProxyFactorycreateSerialisation in class AbstractProxyFactoryprotected void createConstructor(org.apache.xbean.asm4.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
String classFileName)
throws ProxyGenerationException
createConstructor in class AbstractProxyFactorycw - classToProxy - classFileName - ProxyGenerationExceptionprotected void delegateNonInterceptedMethods(ClassLoader classLoader, org.apache.xbean.asm4.ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, Method[] noninterceptedMethods)
delegateNonInterceptedMethods in class AbstractProxyFactorynoninterceptedMethods - all methods which are neither intercepted nor decoratedprotected void delegateInterceptedMethods(ClassLoader classLoader, org.apache.xbean.asm4.ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, Method[] interceptedMethods) throws ProxyGenerationException
AbstractProxyFactorydelegateInterceptedMethods in class AbstractProxyFactoryProxyGenerationExceptionCopyright © 2008-2013 The Apache Software Foundation. All Rights Reserved.