org.springframework.aop.support
Class DelegatingIntroductionInterceptor

java.lang.Object
  extended byorg.springframework.aop.support.DelegatingIntroductionInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, IntroductionInterceptor, org.aopalliance.intercept.MethodInterceptor

public class DelegatingIntroductionInterceptor
extends java.lang.Object
implements IntroductionInterceptor

Convenient implementation of the 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.

Version:
$Id: DelegatingIntroductionInterceptor.java,v 1.4 2004/04/21 10:26:21 jhoeller Exp $
Author:
Rod Johnson

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
protected DelegatingIntroductionInterceptor()
          Construct a new DelegatingIntroductionInterceptor.
  DelegatingIntroductionInterceptor(java.lang.Object delegate)
          Construct a new DelegatingIntroductionInterceptor, providing a delegate that implements the interfaces to be introduced.
 
Method Summary
 java.lang.Class[] getIntroducedInterfaces()
           
 boolean implementsInterface(java.lang.Class intf)
          Does this IntroductionInterceptor implement the given interface?
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation mi)
          Subclasses may need to override this if they want to perform custom behaviour in around advice.
protected  boolean isMethodOnIntroducedInterface(org.aopalliance.intercept.MethodInvocation mi)
          Is this method on an introduced interface?
 void suppressInterface(java.lang.Class intf)
          Suppress the specified interface, which will have been autodetected due to its implementation by the delegate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

DelegatingIntroductionInterceptor

public DelegatingIntroductionInterceptor(java.lang.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

suppressInterface

public void suppressInterface(java.lang.Class intf)
Suppress the specified interface, which will have been autodetected due to its implementation by the delegate. Does nothing if it's not implemented by the delegate

Parameters:
intf - interface to suppress

getIntroducedInterfaces

public java.lang.Class[] getIntroducedInterfaces()

implementsInterface

public boolean implementsInterface(java.lang.Class intf)
Description copied from interface: IntroductionInterceptor
Does this IntroductionInterceptor implement the given interface?

Specified by:
implementsInterface in interface IntroductionInterceptor
Parameters:
intf - interface to check

invoke

public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation mi)
                        throws java.lang.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 interface org.aopalliance.intercept.MethodInterceptor
Throws:
java.lang.Throwable

isMethodOnIntroducedInterface

protected final boolean isMethodOnIntroducedInterface(org.aopalliance.intercept.MethodInvocation mi)
Is this method on an introduced interface?

Parameters:
mi - method invocation
Returns:
whether the method is on an introduced interface


Copyright (C) 2003-2004 The Spring Framework Project.