Interface InterceptionProxy<T>

Type Parameters:
T - the type of the target instance (for which the proxy is created)

public interface InterceptionProxy<T>
A factory for proxies that perform AroundInvoke interception before forwarding the method call to the target instance (delegate).

This construct only supports @AroundInvoke interceptors declared on interceptor classes; other kinds of interception, as well as @AroundInvoke interceptors declared on the target class and its superclasses, are not supported.

The container provides a built-in bean with scope Dependent and qualifier Default that can be injected into a method parameter of a producer method. Synthetic bean creation function can obtain an instance by calling SyntheticCreationalContext.getInterceptionProxy(). The type argument T must be equal to the return type of the producer method or the provider type of the synthetic bean.

 @Produces
 public MyClass produce(InterceptionProxy<MyClass> proxy) {
     return proxy.create(new MyClass());
 }
 
By default, interceptor binding annotations are obtained from the target class (that is, the class of the return type of the producer method or the provider type of the synthetic bean). If you want to override that, use BindingsSource.
  • Method Summary

    Modifier and Type
    Method
    Description
    create(T delegate)
    Creates a proxy that wraps given delegate and performs interception before forwarding the method call to the target instance.
  • Method Details

    • create

      T create(T delegate)
      Creates a proxy that wraps given delegate and performs interception before forwarding the method call to the target instance.
      Parameters:
      delegate - the target instance
      Returns:
      the interception proxy