Package org.springframework.aop.support
Class DelegatingIntroductionInterceptor
- java.lang.Object
- org.springframework.aop.support.IntroductionInfoSupport
- org.springframework.aop.support.DelegatingIntroductionInterceptor
- All Implemented Interfaces:
Serializable
,Advice
,Interceptor
,MethodInterceptor
,DynamicIntroductionAdvice
,IntroductionInfo
,IntroductionInterceptor
public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport implements IntroductionInterceptor
Convenient implementation of theIntroductionInterceptor
interface.Subclasses merely need to extend this class and implement the interfaces to be introduced themselves. In this case the delegate is the subclass instance itself. Alternatively a separate delegate may implement the interface, and be set via the delegate bean property.
Delegates or subclasses may implement any number of interfaces. All interfaces except IntroductionInterceptor are picked up from the subclass or delegate by default.
The
suppressInterface
method can be used to suppress interfaces implemented by the delegate but which should not be introduced to the owning AOP proxy.An instance of this class is serializable if the delegate is.
- Since:
- 16.11.2003
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
IntroductionInfoSupport.suppressInterface(java.lang.Class<?>)
,DelegatePerTargetObjectIntroductionInterceptor
, Serialized Form
Field Summary
Fields inherited from class org.springframework.aop.support.IntroductionInfoSupport
publishedInterfaces
Constructor Summary
Constructors Modifier Constructor Description protected
DelegatingIntroductionInterceptor()
Construct a new DelegatingIntroductionInterceptor.DelegatingIntroductionInterceptor(Object delegate)
Construct a new DelegatingIntroductionInterceptor, providing a delegate that implements the interfaces to be introduced.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
doProceed(MethodInvocation mi)
Proceed with the suppliedMethodInterceptor
.Object
invoke(MethodInvocation mi)
Subclasses may need to override this if they want to perform custom behaviour in around advice.Methods inherited from class org.springframework.aop.support.IntroductionInfoSupport
getInterfaces, implementInterfacesOnObject, implementsInterface, isMethodOnIntroducedInterface, suppressInterface
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.aop.DynamicIntroductionAdvice
implementsInterface
Constructor Detail
DelegatingIntroductionInterceptor
public DelegatingIntroductionInterceptor(Object delegate)
Construct a new DelegatingIntroductionInterceptor, providing a delegate that implements the interfaces to be introduced.- Parameters:
delegate
- the delegate that implements the introduced interfaces
DelegatingIntroductionInterceptor
protected DelegatingIntroductionInterceptor()
Construct a new DelegatingIntroductionInterceptor. The delegate will be the subclass, which must implement additional interfaces.
Method Detail
invoke
public Object invoke(MethodInvocation mi) throws Throwable
Subclasses may need to override this if they want to perform custom behaviour in around advice. However, subclasses should invoke this method, which handles introduced interfaces and forwarding to the target.- Specified by:
invoke
in interfaceMethodInterceptor
- Parameters:
mi
- the method invocation joinpoint- Returns:
- the result of the call to
Joinpoint.proceed()
; might be intercepted by the interceptor - Throws:
Throwable
- if the interceptors or the target object throws an exception
doProceed
protected Object doProceed(MethodInvocation mi) throws Throwable
Proceed with the suppliedMethodInterceptor
. Subclasses can override this method to intercept method invocations on the target object which is useful when an introduction needs to monitor the object that it is introduced into. This method is never called forMethodInvocations
on the introduced interfaces.- Throws:
Throwable