Module lettuce.core

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 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 Details

    • InvocationProxyFactory

      public InvocationProxyFactory()
  • Method Details

    • createProxy

      public <T> T createProxy​(ClassLoader classLoader)
      Create a proxy instance give a ClassLoader.
      Type Parameters:
      T - inferred result type.
      Parameters:
      classLoader - must not be null.
      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 be null and must be an interface type.
    • addInterceptor

      public void addInterceptor​(MethodInterceptor interceptor)
      Add a MethodInterceptor to the interceptor chain.
      Parameters:
      interceptor - notNull