类 ExposeInvocationInterceptor
- java.lang.Object
- org.springframework.aop.interceptor.ExposeInvocationInterceptor
- 所有已实现的接口:
Serializable,Advice,Interceptor,MethodInterceptor,Ordered,PriorityOrdered
public class ExposeInvocationInterceptor extends Object implements MethodInterceptor, PriorityOrdered, Serializable
Interceptor that exposes the currentMethodInvocationas 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 AdvisorADVISORSingleton advisor for this class.static ExposeInvocationInterceptorINSTANCESingleton instance of this class从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static MethodInvocationcurrentInvocation()Return the AOP Alliance MethodInvocation object associated with the current invocation.intgetOrder()Get the order value of this object.Objectinvoke(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
从接口复制的说明:MethodInterceptorImplement 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()
从接口复制的说明:OrderedGet 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-startupvalues).Same order values will result in arbitrary sort positions for the affected objects.
- 指定者:
getOrder在接口中Ordered- 返回:
- the order value
- 另请参阅:
Ordered.HIGHEST_PRECEDENCE,Ordered.LOWEST_PRECEDENCE