public class ExposeInvocationInterceptor extends java.lang.Object implements MethodInterceptor, PriorityOrdered, java.io.Serializable
MethodInvocation
as a thread-local object. We occasionally need to do this; for example, when a pointcut
(e.g. an AspectJ expression pointcut) needs to know the full invocation context.
Don't use this interceptor unless this is really necessary. Target objects should not normally know about Spring AOP, as this creates a dependency on Spring API. Target objects should be plain POJOs as far as possible.
If used, this interceptor will normally be the first in the interceptor chain.
Modifier and Type | Field and Description |
---|---|
static Advisor |
ADVISOR
Singleton advisor for this class.
|
static ExposeInvocationInterceptor |
INSTANCE
Singleton instance of this class
|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Modifier and Type | Method and Description |
---|---|
static MethodInvocation |
currentInvocation()
Return the AOP Alliance MethodInvocation object associated with the current invocation.
|
int |
getOrder()
Get the order value of this object.
|
java.lang.Object |
invoke(MethodInvocation mi)
Implement this method to perform extra treatments before and
after the invocation.
|
public static final ExposeInvocationInterceptor INSTANCE
public static final Advisor ADVISOR
public static MethodInvocation currentInvocation() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if there is no AOP invocation in progress,
or if the ExposeInvocationInterceptor was not added to this interceptor chainpublic java.lang.Object invoke(MethodInvocation mi) throws java.lang.Throwable
MethodInterceptor
Joinpoint.proceed()
.invoke
in interface MethodInterceptor
mi
- the method invocation joinpointJoinpoint.proceed()
;
might be intercepted by the interceptorjava.lang.Throwable
- if the interceptors or the target object
throws an exceptionpublic int getOrder()
Ordered
Higher values are interpreted as lower priority. As a consequence,
the object with the lowest value has the highest priority (somewhat
analogous to Servlet load-on-startup
values).
Same order values will result in arbitrary sort positions for the affected objects.
getOrder
in interface Ordered
Ordered.HIGHEST_PRECEDENCE
,
Ordered.LOWEST_PRECEDENCE