T
- The intercepted typeR
- The result type@Indexed(value=Interceptor.class) public interface Interceptor<T,R> extends Ordered
An Interceptor intercepts the execution of a method allowing cross cutting behaviour to be applied to a method's execution.
All implementations should be thread safe beans
In the case of Around
advice the interceptor should invoke InvocationContext.proceed()
to proceed with the method invocation
In the case of Introduction
advice the interceptor should invoke InvocationContext.proceed()
if it is unable to implement the method. The last call to InvocationContext.proceed()
will produce a
UnsupportedOperationException
indicating the method cannot be implemented. This mechanism allows multiple
possible interceptors to participate in method implementation.
Modifier and Type | Field and Description |
---|---|
static Argument<Interceptor<?,?>> |
ARGUMENT |
static CharSequence |
CACHEABLE_LAZY_TARGET
The
Around.cacheableLazyTarget() setting. |
static CharSequence |
HOTSWAP
The
Around.hotswap() setting. |
static CharSequence |
LAZY
The
Around.lazy() setting. |
static CharSequence |
PROXY_TARGET
The
Around.proxyTarget() setting. |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Modifier and Type | Method and Description |
---|---|
R |
intercept(InvocationContext<T,R> context)
Intercepts an execution from a declared
Around advice. |
static final Argument<Interceptor<?,?>> ARGUMENT
static final CharSequence PROXY_TARGET
Around.proxyTarget()
setting.static final CharSequence HOTSWAP
Around.hotswap()
setting.static final CharSequence LAZY
Around.lazy()
setting.static final CharSequence CACHEABLE_LAZY_TARGET
Around.cacheableLazyTarget()
setting.R intercept(InvocationContext<T,R> context)
Around
advice. The implementation can either call InvocationContext.proceed()
to return the original value or provide a replacement valuecontext
- The interception context