类 ExposeInvocationInterceptor
java.lang.Object
infra.aop.interceptor.ExposeInvocationInterceptor
- 所有已实现的接口:
infra.core.Ordered,Serializable,Advice,Interceptor,MethodInterceptor
public final class ExposeInvocationInterceptor
extends Object
implements MethodInterceptor, infra.core.Ordered, Serializable
Interceptor that exposes the current
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 AOP, as this creates a dependency on API. Target objects should be plain POJOs as far as possible.
If used, this interceptor will normally be the first in the interceptor chain.
- 从以下版本开始:
- 3.0
- 作者:
- Rod Johnson, Juergen Hoeller, TODAY 2021/2/3 23:40
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明static final AdvisorSingleton advisor for this class.static final ExposeInvocationInterceptorSingleton instance of this class.private static final ThreadLocal<MethodInvocation>从接口继承的字段 infra.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
构造器概要
构造器限定符构造器说明privateEnsures that only the canonical instance can be created. -
方法概要
修饰符和类型方法说明static MethodInvocationReturn the AOP Alliance MethodInvocation object associated with the current invocation.intgetOrder()Implement this method to perform extra treatments before and after the invocation.private ObjectRequired to support serialization.
-
字段详细资料
-
INSTANCE
Singleton instance of this class. -
ADVISOR
Singleton advisor for this class. Use in preference to INSTANCE when using AOP, as it prevents the need to create a new Advisor to wrap the instance. -
invocation
-
-
构造器详细资料
-
ExposeInvocationInterceptor
private ExposeInvocationInterceptor()Ensures that only the canonical instance can be created.
-
-
方法详细资料
-
currentInvocation
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
从接口复制的说明: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()- 指定者:
getOrder在接口中infra.core.Ordered
-
readResolve
Required to support serialization. Replaces with canonical instance on deserialization, protecting Singleton pattern.Alternative to overriding the
equalsmethod.
-