Top Description Fields Constructors Methods
org.springframework.aop.support

public Class DelegatingIntroductionInterceptor

extends IntroductionInfoSupport
implements IntroductionInterceptor
Class Inheritance
All Implemented Interfaces
org.springframework.aop.IntroductionInterceptor, org.springframework.aop.DynamicIntroductionAdvice, org.aopalliance.aop.Advice, org.aopalliance.intercept.MethodInterceptor, org.aopalliance.intercept.Interceptor
Known Direct Subclasses
org.springframework.aop.interceptor.ExposeBeanNameAdvisors.ExposeBeanNameIntroduction
Annotations
@SuppressWarnings:serial
Imports
org.aopalliance.intercept.MethodInvocation, org.springframework.aop.DynamicIntroductionAdvice, .IntroductionInterceptor, .ProxyMethodInvocation, org.springframework.lang.Nullable, org.springframework.util.Assert

Convenient implementation of the org.springframework.aop.IntroductionInterceptor 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.

Authors
Rod Johnson, Juergen Hoeller
Since
16.11.2003
See Also
suppressInterface, DelegatePerTargetObjectIntroductionInterceptor

Field Summary

Modifier and TypeField and Description
private Object
delegate

Object that actually implements the interfaces.

Inherited from org.springframework.aop.support.IntroductionInfoSupport:
publishedInterfaces

Constructor Summary

AccessConstructor and Description
public
DelegatingIntroductionInterceptor(Object
the delegate that implements the introduced interfaces
delegate
)

Construct a new DelegatingIntroductionInterceptor, providing a delegate that implements the interfaces to be introduced.

protected
DelegatingIntroductionInterceptor()

Construct a new DelegatingIntroductionInterceptor.

Method Summary

Modifier and TypeMethod and Description
protected Object
private void
init(Object
the delegate object
delegate
)

Both constructors use this init method, as it is impossible to pass a "this" reference from one constructor to another.

public Object
invoke(MethodInvocation
the method invocation joinpoint
mi
)

Implements org.aopalliance.intercept.MethodInterceptor.invoke.

Subclasses may need to override this if they want to perform custom behaviour in around advice.
Inherited from org.springframework.aop.support.IntroductionInfoSupport:
getInterfacesimplementInterfacesOnObjectimplementsInterfaceisMethodOnIntroducedInterfacesuppressInterface

Field Detail

delegateback to summary
private Object delegate

Object that actually implements the interfaces. May be "this" if a subclass implements the introduced interfaces.

Annotations
@Nullable

Constructor Detail

DelegatingIntroductionInterceptorback to summary
public DelegatingIntroductionInterceptor(Object delegate)

Construct a new DelegatingIntroductionInterceptor, providing a delegate that implements the interfaces to be introduced.

Parameters
delegate:Object

the delegate that implements the introduced interfaces

DelegatingIntroductionInterceptorback to summary
protected DelegatingIntroductionInterceptor()

Construct a new DelegatingIntroductionInterceptor. The delegate will be the subclass, which must implement additional interfaces.

Method Detail

doProceedback to summary
protected Object doProceed(MethodInvocation mi) throws Throwable

Proceed with the supplied org.aopalliance.intercept.MethodInterceptor. 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 for MethodInvocations on the introduced interfaces.

Annotations
@Nullable
initback to summary
private void init(Object delegate)

Both constructors use this init method, as it is impossible to pass a "this" reference from one constructor to another.

Parameters
delegate:Object

the delegate object

invokeback to summary
public Object invoke(MethodInvocation mi) throws Throwable

Implements org.aopalliance.intercept.MethodInterceptor.invoke.

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.

Parameters
mi:MethodInvocation

Doc from org.aopalliance.intercept.MethodInterceptor.invoke.

the method invocation joinpoint

Returns:Object

Doc from org.aopalliance.intercept.MethodInterceptor.invoke.

the result of the call to Joinpoint#proceed(); might be intercepted by the interceptor

Annotations
@Override
@Nullable
Exceptions
Throwable:

Doc from org.aopalliance.intercept.MethodInterceptor.invoke.

if the interceptors or the target object throws an exception