类 ExposeInvocationInterceptor
- java.lang.Object
- org.springframework.aop.interceptor.ExposeInvocationInterceptor
- 所有已实现的接口:
Serializable
,Advice
,Interceptor
,MethodInterceptor
,Ordered
,PriorityOrdered
public final class ExposeInvocationInterceptor extends Object implements MethodInterceptor, PriorityOrdered, Serializable
Interceptor that exposes the currentMethodInvocation
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.
- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
- 序列化表格
字段概要
字段 修饰符和类型 字段 说明 static Advisor
ADVISOR
Singleton advisor for this class.static ExposeInvocationInterceptor
INSTANCE
Singleton instance of this class.从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static MethodInvocation
currentInvocation()
Return the AOP Alliance MethodInvocation object associated with the current invocation.int
getOrder()
Get the order value of this object.Object
invoke(MethodInvocation mi)
Implement this method to perform extra treatments before and after the invocation.
字段详细资料
INSTANCE
public static final ExposeInvocationInterceptor INSTANCE
Singleton instance of this class.
方法详细资料
currentInvocation
public static MethodInvocation currentInvocation() throws IllegalStateException
Return the AOP Alliance MethodInvocation object associated with the current invocation.- 返回:
- the invocation object associated with the current invocation
- 抛出:
IllegalStateException
- if there is no AOP invocation in progress, or if the ExposeInvocationInterceptor was not added to this interceptor chain
invoke
public Object invoke(MethodInvocation mi) throws Throwable
从接口复制的说明:MethodInterceptor
Implement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invokeJoinpoint.proceed()
.- 指定者:
invoke
在接口中MethodInterceptor
- 参数:
mi
- the method invocation joinpoint- 返回:
- the result of the call to
Joinpoint.proceed()
; might be intercepted by the interceptor - 抛出:
Throwable
- if the interceptors or the target object throws an exception
getOrder
public int getOrder()
从接口复制的说明:Ordered
Get the order value of this object.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
在接口中Ordered
- 返回:
- the order value
- 另请参阅:
Ordered.HIGHEST_PRECEDENCE
,Ordered.LOWEST_PRECEDENCE