java.lang.Object
io.lettuce.core.dynamic.intercept.InvocationProxyFactory
public class InvocationProxyFactory extends Object
Factory to create invocation proxies.
Method calls to invocation proxies can be intercepted and modified by a chain of MethodInterceptors. Each
MethodInterceptor can continue the call chain, terminate prematurely or modify all aspects of a Method
invocation.
InvocationProxyFactory produces invocation proxies which can implement multiple interface type. Any non-interface
types are rejected.
- Since:
- 5.0
- Author:
- Mark Paluch
- See Also:
MethodInterceptor,MethodInvocation
-
Constructor Summary
Constructors Constructor Description InvocationProxyFactory() -
Method Summary
Modifier and Type Method Description voidaddInterceptor(MethodInterceptor interceptor)Add aMethodInterceptorto the interceptor chain.voidaddInterface(Class<?> ifc)Add a interface type that should be implemented by the resulting invocation proxy.<T> TcreateProxy(ClassLoader classLoader)Create a proxy instance give aClassLoader.
-
Constructor Details
-
InvocationProxyFactory
public InvocationProxyFactory()
-
-
Method Details
-
createProxy
Create a proxy instance give aClassLoader.- Type Parameters:
T- inferred result type.- Parameters:
classLoader- must not benull.- Returns:
- the invocation proxy instance.
-
addInterface
Add a interface type that should be implemented by the resulting invocation proxy.- Parameters:
ifc- must not benulland must be an interface type.
-
addInterceptor
Add aMethodInterceptorto the interceptor chain.- Parameters:
interceptor- notNull
-