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, MODIFIER_VARARGS, webBeansContext
Constructor and Description |
---|
InterceptorDecoratorProxyFactory(WebBeansContext webBeansContext) |
Modifier and Type | Method and Description |
---|---|
protected void |
createConstructor(org.objectweb.asm.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.objectweb.asm.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.objectweb.asm.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
String classFileName)
generate the bytecode for serialization.
|
protected void |
delegateInterceptedMethods(ClassLoader classLoader,
org.objectweb.asm.ClassWriter cw,
String proxyClassFileName,
Class<?> classToProxy,
Method[] interceptedMethods)
generate the bytecode for invoking all intercepted methods
|
protected void |
delegateNonInterceptedMethods(ClassLoader classLoader,
org.objectweb.asm.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, getProxyClassLoader, getReturnInsn, getUnusedProxyClassName, getVarInsn, getWrapperType, pushIntOntoStack, pushMethodParameterArray, unproxyableMethod, unsafeNewInstance
public 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
ProxyGenerationException
public 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 classclassToProxy
- 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 directlyProxyGenerationException
public <T> Class<T> getCachedProxyClass(javax.enterprise.inject.spi.Bean<T> bean)
protected Class getMarkerInterface()
getMarkerInterface
in class AbstractProxyFactory
protected void createInstanceVariables(org.objectweb.asm.ClassWriter cw, Class<?> classToProxy, String classFileName)
AbstractProxyFactory
createInstanceVariables
in class AbstractProxyFactory
protected void createSerialisation(org.objectweb.asm.ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName)
AbstractProxyFactory
createSerialisation
in class AbstractProxyFactory
protected void createConstructor(org.objectweb.asm.ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName) throws ProxyGenerationException
createConstructor
in class AbstractProxyFactory
cw
- classToProxy
- classFileName
- ProxyGenerationException
protected void delegateNonInterceptedMethods(ClassLoader classLoader, org.objectweb.asm.ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, Method[] noninterceptedMethods)
delegateNonInterceptedMethods
in class AbstractProxyFactory
noninterceptedMethods
- all methods which are neither intercepted nor decoratedprotected void delegateInterceptedMethods(ClassLoader classLoader, org.objectweb.asm.ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, Method[] interceptedMethods) throws ProxyGenerationException
AbstractProxyFactory
delegateInterceptedMethods
in class AbstractProxyFactory
ProxyGenerationException
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.