站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

ExposeInvocationInterceptor (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.aop.interceptor
Class ExposeInvocationInterceptor

java.lang.Object
  extended by org.springframework.aop.interceptor.ExposeInvocationInterceptor
All Implemented Interfaces:
Serializable, Advice, Interceptor, MethodInterceptor

public class ExposeInvocationInterceptor
extends Object
implements MethodInterceptor, Serializable

Interceptor that exposes the current MethodInvocation. We occasionally need to do this; for example, when a pointcut or target object needs to know the 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. Target objects should be plain POJOs as far as possible.

If used, this interceptor will normally be the first in the interceptor chain.

Author:
Rod Johnson
See Also:
Serialized Form

Field Summary
static Advisor ADVISOR
          Singleton advisor for this class.
static ExposeInvocationInterceptor INSTANCE
          Singleton instance of this class
 
Method Summary
static MethodInvocation currentInvocation()
          Return the AOP Alliance MethodInvocation object associated with the current invocation.
 Object invoke(MethodInvocation mi)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ExposeInvocationInterceptor INSTANCE
Singleton instance of this class


ADVISOR

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.

Method Detail

currentInvocation

public static MethodInvocation currentInvocation()
                                          throws IllegalStateException
Return the AOP Alliance MethodInvocation object associated with the current invocation.

Returns:
the invocation object associated with the current invocation
Throws:
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
Specified by:
invoke in interface MethodInterceptor
Throws:
Throwable

The Spring Framework

Copyright © 2002-2007 The Spring Framework.