Class InterceptorChain

  • All Implemented Interfaces:
    org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

    public class InterceptorChain
    extends Object
    implements org.aopalliance.intercept.MethodInterceptor

    An adaptation of Guice's InterceptorStackCallback (author: Bob Lee), but generalized to use the AOP alliance interfaces. This class is used to hold a chain of MethodInterceptors, which are invoked in order by the proxy. Any interceptor that does not call MethodInvocation#proceed() will effectively short-circuit the traversal of the chain and prevent the target from being called.

    Author:
    Brennan Spies
    • Constructor Detail

      • InterceptorChain

        public InterceptorChain​(List<org.aopalliance.intercept.MethodInterceptor> interceptorList)
      • InterceptorChain

        public InterceptorChain​(org.aopalliance.intercept.MethodInterceptor... interceptors)
    • Method Detail

      • invoke

        public Object invoke​(org.aopalliance.intercept.MethodInvocation methodInvocation)
                      throws Throwable
        Invokes the interceptor chain.
        Specified by:
        invoke in interface org.aopalliance.intercept.MethodInterceptor
        Parameters:
        methodInvocation - The method invocation
        Returns:
        The return value
        Throws:
        Throwable - If an error occurs during invocation