Class InvocationProxyFactory
- 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
MethodInterceptor
s. EachMethodInterceptor
can continue the call chain, terminate prematurely or modify all aspects of aMethod
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInterceptor(MethodInterceptor interceptor)
Add aMethodInterceptor
to the interceptor chain.void
addInterface(Class<?> ifc)
Add a interface type that should be implemented by the resulting invocation proxy.<T> T
createProxy(ClassLoader classLoader)
Create a proxy instance give aClassLoader
.
-
-
-
Method Detail
-
createProxy
public <T> T createProxy(ClassLoader classLoader)
Create a proxy instance give aClassLoader
.- Type Parameters:
T
- inferred result type.- Parameters:
classLoader
- must not benull
.- Returns:
- the invocation proxy instance.
-
addInterface
public void addInterface(Class<?> ifc)
Add a interface type that should be implemented by the resulting invocation proxy.- Parameters:
ifc
- must not benull
and must be an interface type.
-
addInterceptor
public void addInterceptor(MethodInterceptor interceptor)
Add aMethodInterceptor
to the interceptor chain.- Parameters:
interceptor
- notNull
-
-