org.aopalliance.intercept.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 |
|---|---|
| public static final Advisor | ADVISOR
Singleton advisor for this class. |
| public static final ExposeInvocationInterceptor | INSTANCE
Singleton instance of this class. |
| private static final ThreadLocal |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static MethodInvocation | Returns: the invocation object associated with the current invocationReturn the AOP Alliance MethodInvocation object associated with the current invocation. |
| public int | |
| public Object | invoke(MethodInvocation
the method invocation joinpoint mi)Implements org. |
| private Object |
| ADVISOR | back to summary |
|---|---|
| public static final Advisor ADVISOR Singleton advisor for this class. Use in preference to INSTANCE when using Spring AOP, as it prevents the need to create a new Advisor to wrap the instance. | |
| INSTANCE | back to summary |
|---|---|
| public static final ExposeInvocationInterceptor INSTANCE Singleton instance of this class. | |
| invocation | back to summary |
|---|---|
| private static final ThreadLocal<MethodInvocation> invocation | |
| ExposeInvocationInterceptor | back to summary |
|---|---|
| private ExposeInvocationInterceptor() Ensures that only the canonical instance can be created. | |
| currentInvocation | back to summary |
|---|---|
| public static MethodInvocation currentInvocation() throws IllegalStateException Return the AOP Alliance MethodInvocation object associated with the current invocation.
| |
| getOrder | back to summary |
|---|---|
| public int getOrder() Implements org. Doc from org. 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 Same order values will result in arbitrary sort positions for the affected objects.
| |
| invoke | back to summary |
|---|---|
| public Object invoke(MethodInvocation mi) throws Throwable Implements org. Doc from org. Implement this method to perform extra treatments before and
after the invocation. Polite implementations would certainly
like to invoke
| |
| readResolve | back to summary |
|---|---|
| private Object readResolve() Required to support serialization. Replaces with canonical instance on deserialization, protecting Singleton pattern. Alternative to overriding the | |