Package io.micronaut.aop
Interface Interceptor<T,R>
-
- Type Parameters:
T
- The intercepted typeR
- The result type
- All Superinterfaces:
io.micronaut.core.order.Ordered
- All Known Subinterfaces:
ConstructorInterceptor<T>
,MethodInterceptor<T,R>
@Indexed(Interceptor.class) public interface Interceptor<T,R> extends io.micronaut.core.order.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 invokeInvocationContext.proceed()
to proceed with the method invocationIn the case of
Introduction
advice the interceptor should invokeInvocationContext.proceed()
if it is unable to implement the method. The last call toInvocationContext.proceed()
will produce aUnsupportedOperationException
indicating the method cannot be implemented. This mechanism allows multiple possible interceptors to participate in method implementation.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static io.micronaut.core.type.Argument<Interceptor<?,?>>
ARGUMENT
static java.lang.CharSequence
CACHEABLE_LAZY_TARGET
TheAround.cacheableLazyTarget()
setting.static java.lang.CharSequence
HOTSWAP
TheAround.hotswap()
setting.static java.lang.CharSequence
LAZY
TheAround.lazy()
setting.static java.lang.CharSequence
PROXY_TARGET
TheAround.proxyTarget()
setting.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description R
intercept(InvocationContext<T,R> context)
Intercepts an execution from a declaredAround
advice.
-
-
-
Field Detail
-
ARGUMENT
static final io.micronaut.core.type.Argument<Interceptor<?,?>> ARGUMENT
-
PROXY_TARGET
static final java.lang.CharSequence PROXY_TARGET
TheAround.proxyTarget()
setting.
-
HOTSWAP
static final java.lang.CharSequence HOTSWAP
TheAround.hotswap()
setting.
-
LAZY
static final java.lang.CharSequence LAZY
TheAround.lazy()
setting.
-
CACHEABLE_LAZY_TARGET
static final java.lang.CharSequence CACHEABLE_LAZY_TARGET
TheAround.cacheableLazyTarget()
setting.
-
-
Method Detail
-
intercept
R intercept(InvocationContext<T,R> context)
Intercepts an execution from a declaredAround
advice. The implementation can either callInvocationContext.proceed()
to return the original value or provide a replacement value- Parameters:
context
- The interception context- Returns:
- result type
-
-