public abstract class BaseProxyFactory extends Object implements ProxyFactory
Abstract base implementation of ProxyFactory.
| Constructor and Description |
|---|
BaseProxyFactory()
Default constructor with no preferred class loader.
|
BaseProxyFactory(ClassLoader preferredClassLoader)
Constructor that takes the preferred class loader for loading
proxy interfaces.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertClassVisible(ClassLoader loader,
Class<?> type)
Verifies that the given class is visible from the given class loader.
|
protected void |
assertInterfaces(Class<?>... types)
Verifies that all the given classes are interfaces.
|
<T> T |
createProxy(Class<T> proxyClass,
T target,
Class<? extends Annotation> marker,
org.aopalliance.intercept.MethodInterceptor... interceptors)
Creates a "protection" proxy where method invocations on the proxy are intercepted by the
chain of
MethodInterceptors before (optionally) being invoked on the target. |
protected NamingPolicy |
getNamingStrategy()
Returns a
NamingPolicy that can be used to create
proxy class names. |
protected ClassLoader |
getPreferredClassLoader()
Returns the specified
ClassLoader that is used to define any
proxy interfaces. |
protected ClassLoader |
getProxyClassLoader(Class<?> proxyType)
Returns the
ClassLoader that should be used to load
the proxy. |
void |
setNamingStrategy(NamingPolicy namingPolicy)
Sets the naming policy used to determine the proxy class name.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuildInterceptor, createProxy, createProxy, createProxypublic BaseProxyFactory()
public BaseProxyFactory(ClassLoader preferredClassLoader)
preferredClassLoader - The class loader for proxy interfacesprotected NamingPolicy getNamingStrategy()
NamingPolicy that can be used to create
proxy class names.@Inject public void setNamingStrategy(NamingPolicy namingPolicy)
namingPolicy - The naming policy to setprotected ClassLoader getPreferredClassLoader()
ClassLoader that is used to define any
proxy interfaces.ClassLoader used to define proxy interfacesprotected ClassLoader getProxyClassLoader(Class<?> proxyType)
ClassLoader that should be used to load
the proxy.proxyType - The class of the proxyClassLoaderprotected void assertClassVisible(ClassLoader loader, Class<?> type) throws GenerationException
loader - The class loader that needs visibility to the classtype - The class to verityGenerationException - If type is not visible from the class loaderprotected void assertInterfaces(Class<?>... types) throws GenerationException
types - The classes to testGenerationException - If at least one class is not an interfacepublic <T> T createProxy(Class<T> proxyClass, T target, Class<? extends Annotation> marker, org.aopalliance.intercept.MethodInterceptor... interceptors) throws GenerationException
ProxyFactoryMethodInterceptors before (optionally) being invoked on the target.createProxy in interface ProxyFactoryT - The proxy typeproxyClass - The proxy classtarget - The target of the invocationmarker - The annotation that marks intercepted methodsinterceptors - One or more method interceptors, which are called in orderGenerationException - If an error occurs creating the proxyProxyFactory.createProxy(Class, Object, Class, org.aopalliance.intercept.MethodInterceptor...)Copyright © 2014. All rights reserved.