Package org.proxy4j.core.cglib
Class CglibProxyFactory
- java.lang.Object
-
- org.proxy4j.core.BaseProxyFactory
-
- org.proxy4j.core.cglib.CglibProxyFactory
-
- All Implemented Interfaces:
ProxyFactory
public class CglibProxyFactory extends BaseProxyFactory
ProxyFactoryimplementation using CGLIB.- Since:
- 1.0
- Author:
- Brennan Spies
-
-
Constructor Summary
Constructors Constructor Description CglibProxyFactory()CglibProxyFactory(ClassLoader loader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> InterceptorBuilder<T>buildInterceptor(Class<T> proxyClass)The proxy class in this implementation does not have to be an interface.ObjectcreateProxy(Class<?>[] proxyInterfaces, ProxyHandler<?> handler)The proxy classes must be interfaces, or anGenerationExceptionwill be thrown.<T> TcreateProxy(Class<T> proxyClass, javax.inject.Provider<T> provider)The proxy class in this implementation does not have to be an interface.<T> TcreateProxy(Class<T> proxyClass, ProxyHandler<T> handler)The proxy class in this implementation does not have to be an interface.-
Methods inherited from class org.proxy4j.core.BaseProxyFactory
assertClassVisible, assertInterfaces, createProxy, getNamingStrategy, getPreferredClassLoader, getProxyClassLoader, setNamingStrategy
-
-
-
-
Constructor Detail
-
CglibProxyFactory
public CglibProxyFactory()
-
CglibProxyFactory
@Inject public CglibProxyFactory(ClassLoader loader)
-
-
Method Detail
-
createProxy
public <T> T createProxy(Class<T> proxyClass, javax.inject.Provider<T> provider) throws GenerationException
The proxy class in this implementation does not have to be an interface.- Type Parameters:
T- The proxy type- Parameters:
proxyClass- The proxied classprovider- The provider of the proxied object- Returns:
- The proxy
- Throws:
GenerationException- If an error occurs creating the proxy- See Also:
ProxyFactory.createProxy(Class, javax.inject.Provider)
-
createProxy
public <T> T createProxy(Class<T> proxyClass, ProxyHandler<T> handler) throws GenerationException
The proxy class in this implementation does not have to be an interface.- Type Parameters:
T- The proxy type- Parameters:
proxyClass- The proxied interface classhandler- The handler for the method invocation- Returns:
- The proxy
- Throws:
GenerationException- If an error occurs creating the proxy- See Also:
ProxyFactory.createProxy(Class, org.proxy4j.core.ProxyHandler)
-
createProxy
public Object createProxy(Class<?>[] proxyInterfaces, ProxyHandler<?> handler) throws GenerationException
The proxy classes must be interfaces, or anGenerationExceptionwill be thrown.- Parameters:
proxyInterfaces- The interfaces that the proxy class must implementhandler- The handler for the method invocation- Returns:
- The proxy
- Throws:
GenerationException- If an error occurs creating the proxy- See Also:
ProxyFactory.createProxy(Class[], org.proxy4j.core.ProxyHandler)
-
buildInterceptor
public <T> InterceptorBuilder<T> buildInterceptor(Class<T> proxyClass)
The proxy class in this implementation does not have to be an interface.- Type Parameters:
T- The proxy type- Parameters:
proxyClass- The class of the proxy (and target)- Returns:
- The builder
- See Also:
ProxyFactory.buildInterceptor(Class)
-
-