org.springframework.aop.aspectj
Class DeclareParentsAdvisor

java.lang.Object
  extended by org.springframework.aop.aspectj.DeclareParentsAdvisor
All Implemented Interfaces:
Advisor, IntroductionAdvisor, IntroductionInfo

public class DeclareParentsAdvisor
extends java.lang.Object
implements IntroductionAdvisor

Introduction advisor delegating to the given object. Implements AspectJ annotation-style behavior for the DeclareParents annotation.

Since:
2.0
Author:
Rod Johnson, Ramnivas Laddad

Field Summary
private  Advice advice
           
private  java.lang.Class introducedInterface
           
private  ClassFilter typePatternClassFilter
           
 
Constructor Summary
  DeclareParentsAdvisor(java.lang.Class interfaceType, java.lang.String typePattern, java.lang.Class defaultImpl)
          Create a new advisor for this DeclareParents field.
private DeclareParentsAdvisor(java.lang.Class interfaceType, java.lang.String typePattern, java.lang.Class implementationClass, Advice advice)
          Private constructor to share common code between impl-based delegate and reference-based delegate (cannot use method such as init() to share common code, due the the use of final fields)
  DeclareParentsAdvisor(java.lang.Class interfaceType, java.lang.String typePattern, java.lang.Object delegateRef)
          Create a new advisor for this DeclareParents field.
 
Method Summary
 Advice getAdvice()
          Return the advice part of this aspect.
 ClassFilter getClassFilter()
          Return the filter determining which target classes this introduction should apply to.
 java.lang.Class[] getInterfaces()
          Return the additional interfaces introduced by this Advisor or Advice.
 boolean isPerInstance()
          Return whether this advice is associated with a particular instance (for example, creating a mixin) or shared with all instances of the advised class obtained from the same Spring bean factory.
 void validateInterfaces()
          Can the advised interfaces be implemented by the introduction advice? Invoked before adding an IntroductionAdvisor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

introducedInterface

private final java.lang.Class introducedInterface

typePatternClassFilter

private final ClassFilter typePatternClassFilter

advice

private final Advice advice
Constructor Detail

DeclareParentsAdvisor

public DeclareParentsAdvisor(java.lang.Class interfaceType,
                             java.lang.String typePattern,
                             java.lang.Class defaultImpl)
Create a new advisor for this DeclareParents field.

Parameters:
interfaceType - static field defining the introduction
typePattern - type pattern the introduction is restricted to
defaultImpl - the default implementation class

DeclareParentsAdvisor

public DeclareParentsAdvisor(java.lang.Class interfaceType,
                             java.lang.String typePattern,
                             java.lang.Object delegateRef)
Create a new advisor for this DeclareParents field.

Parameters:
interfaceType - static field defining the introduction
typePattern - type pattern the introduction is restricted to
delegateRef - the delegate implementation object

DeclareParentsAdvisor

private DeclareParentsAdvisor(java.lang.Class interfaceType,
                              java.lang.String typePattern,
                              java.lang.Class implementationClass,
                              Advice advice)
Private constructor to share common code between impl-based delegate and reference-based delegate (cannot use method such as init() to share common code, due the the use of final fields)

Parameters:
interfaceType - static field defining the introduction
typePattern - type pattern the introduction is restricted to
implementationClass - implementation class
advice - delegation advice
Method Detail

getClassFilter

public ClassFilter getClassFilter()
Description copied from interface: IntroductionAdvisor
Return the filter determining which target classes this introduction should apply to.

This represents the class part of a pointcut. Note that method matching doesn't make sense to introductions.

Specified by:
getClassFilter in interface IntroductionAdvisor
Returns:
the class filter

validateInterfaces

public void validateInterfaces()
                        throws java.lang.IllegalArgumentException
Description copied from interface: IntroductionAdvisor
Can the advised interfaces be implemented by the introduction advice? Invoked before adding an IntroductionAdvisor.

Specified by:
validateInterfaces in interface IntroductionAdvisor
Throws:
java.lang.IllegalArgumentException - if the advised interfaces can't be implemented by the introduction advice

isPerInstance

public boolean isPerInstance()
Description copied from interface: Advisor
Return whether this advice is associated with a particular instance (for example, creating a mixin) or shared with all instances of the advised class obtained from the same Spring bean factory.

Note that this method is not currently used by the framework. Typical Advisor implementations always return true. Use singleton/prototype bean definitions or appropriate programmatic proxy creation to ensure that Advisors have the correct lifecycle model.

Specified by:
isPerInstance in interface Advisor
Returns:
whether this advice is associated with a particular target instance

getAdvice

public Advice getAdvice()
Description copied from interface: Advisor
Return the advice part of this aspect. An advice may be an interceptor, a before advice, a throws advice, etc.

Specified by:
getAdvice in interface Advisor
Returns:
the advice that should apply if the pointcut matches
See Also:
org.aopalliance.intercept.MethodInterceptor, BeforeAdvice, ThrowsAdvice, AfterReturningAdvice

getInterfaces

public java.lang.Class[] getInterfaces()
Description copied from interface: IntroductionInfo
Return the additional interfaces introduced by this Advisor or Advice.

Specified by:
getInterfaces in interface IntroductionInfo
Returns:
the introduced interfaces