Package org.proxy4j.core
Class InterceptorChain
- java.lang.Object
-
- org.proxy4j.core.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 callMethodInvocation#proceed()will effectively short-circuit the traversal of the chain and prevent the target from being called.- Author:
- Brennan Spies
-
-
Constructor Summary
Constructors Constructor Description InterceptorChain(List<org.aopalliance.intercept.MethodInterceptor> interceptorList)InterceptorChain(org.aopalliance.intercept.MethodInterceptor... interceptors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectinvoke(org.aopalliance.intercept.MethodInvocation methodInvocation)Invokes the interceptor chain.
-
-
-
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:
invokein interfaceorg.aopalliance.intercept.MethodInterceptor- Parameters:
methodInvocation- The method invocation- Returns:
- The return value
- Throws:
Throwable- If an error occurs during invocation
-
-