org.springframework.aop.aspectj.annotation
Class InstantiationModelAwarePointcutAdvisorImpl

java.lang.Object
  extended by org.springframework.aop.aspectj.annotation.InstantiationModelAwarePointcutAdvisorImpl
All Implemented Interfaces:
Advisor, AspectJPrecedenceInformation, InstantiationModelAwarePointcutAdvisor, PointcutAdvisor, Ordered

 class InstantiationModelAwarePointcutAdvisorImpl
extends java.lang.Object
implements InstantiationModelAwarePointcutAdvisor, AspectJPrecedenceInformation

Internal implementation of AspectJPointcutAdvisor. Note that there will be one instance of this advisor for each target method.

Since:
2.0
Author:
Rod Johnson, Juergen Hoeller

Nested Class Summary
private  class InstantiationModelAwarePointcutAdvisorImpl.PerTargetInstantiationModelPointcut
          Pointcut implementation that changes its behaviour when the advice is instantiated.
 
Field Summary
private  MetadataAwareAspectInstanceFactory aspectInstanceFactory
           
private  java.lang.String aspectName
           
private  AspectJAdvisorFactory atAspectJAdvisorFactory
           
private  int declarationOrder
           
private  AspectJExpressionPointcut declaredPointcut
           
private  Advice instantiatedAdvice
           
private  java.lang.Boolean isAfterAdvice
           
private  java.lang.Boolean isBeforeAdvice
           
private  boolean lazy
           
private  java.lang.reflect.Method method
           
private  Pointcut pointcut
           
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
InstantiationModelAwarePointcutAdvisorImpl(AspectJAdvisorFactory af, AspectJExpressionPointcut ajexp, MetadataAwareAspectInstanceFactory aif, java.lang.reflect.Method method, int declarationOrderInAspect, java.lang.String aspectName)
           
 
Method Summary
private  void determineAdviceType()
          Duplicates some logic from getAdvice, but importantly does not force creation of the advice.
 Advice getAdvice()
          Lazily instantiate advice if necessary.
 MetadataAwareAspectInstanceFactory getAspectInstanceFactory()
           
 AspectMetadata getAspectMetadata()
          Return the AspectJ AspectMetadata for this advisor.
 java.lang.String getAspectName()
          The name of the aspect (bean) in which the advice was declared.
 int getDeclarationOrder()
          The declaration order of the advice member within the aspect.
 AspectJExpressionPointcut getDeclaredPointcut()
           
 int getOrder()
          Return the order value of this object, with a higher value meaning greater in terms of sorting.
 Pointcut getPointcut()
          The pointcut for Spring AOP to use.
private  Advice instantiateAdvice(AspectJExpressionPointcut pcut)
           
 boolean isAdviceInstantiated()
          Return whether this advisor has already instantiated its advice.
 boolean isAfterAdvice()
          Return whether this is an after advice.
 boolean isBeforeAdvice()
          Return whether this is a before advice.
 boolean isLazy()
          Return whether this advisor is lazily initializing its underlying advice.
 boolean isPerInstance()
          This is only of interest for Spring AOP: AspectJ instantiation semantics are much richer.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

declaredPointcut

private final AspectJExpressionPointcut declaredPointcut

pointcut

private Pointcut pointcut

aspectInstanceFactory

private final MetadataAwareAspectInstanceFactory aspectInstanceFactory

method

private final java.lang.reflect.Method method

lazy

private final boolean lazy

atAspectJAdvisorFactory

private final AspectJAdvisorFactory atAspectJAdvisorFactory

instantiatedAdvice

private Advice instantiatedAdvice

declarationOrder

private int declarationOrder

aspectName

private java.lang.String aspectName

isBeforeAdvice

private java.lang.Boolean isBeforeAdvice

isAfterAdvice

private java.lang.Boolean isAfterAdvice
Constructor Detail

InstantiationModelAwarePointcutAdvisorImpl

public InstantiationModelAwarePointcutAdvisorImpl(AspectJAdvisorFactory af,
                                                  AspectJExpressionPointcut ajexp,
                                                  MetadataAwareAspectInstanceFactory aif,
                                                  java.lang.reflect.Method method,
                                                  int declarationOrderInAspect,
                                                  java.lang.String aspectName)
Method Detail

getPointcut

public Pointcut getPointcut()
The pointcut for Spring AOP to use. Actual behaviour of the pointcut will change depending on the state of the advice.

Specified by:
getPointcut in interface PointcutAdvisor

isPerInstance

public boolean isPerInstance()
This is only of interest for Spring AOP: AspectJ instantiation semantics are much richer. In AspectJ terminology, all a return of true means here is that the aspect is not a SINGLETON.

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

getAspectMetadata

public AspectMetadata getAspectMetadata()
Return the AspectJ AspectMetadata for this advisor.


getAdvice

public Advice getAdvice()
Lazily instantiate advice if necessary.

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

isLazy

public boolean isLazy()
Description copied from interface: InstantiationModelAwarePointcutAdvisor
Return whether this advisor is lazily initializing its underlying advice.

Specified by:
isLazy in interface InstantiationModelAwarePointcutAdvisor

isAdviceInstantiated

public boolean isAdviceInstantiated()
Description copied from interface: InstantiationModelAwarePointcutAdvisor
Return whether this advisor has already instantiated its advice.

Specified by:
isAdviceInstantiated in interface InstantiationModelAwarePointcutAdvisor

instantiateAdvice

private Advice instantiateAdvice(AspectJExpressionPointcut pcut)

getAspectInstanceFactory

public MetadataAwareAspectInstanceFactory getAspectInstanceFactory()

getDeclaredPointcut

public AspectJExpressionPointcut getDeclaredPointcut()

getOrder

public int getOrder()
Description copied from interface: Ordered
Return the order value of this object, with a higher value meaning greater in terms of sorting.

Normally starting with 0, with Integer.MAX_VALUE indicating the greatest value. Same order values will result in arbitrary positions for the affected objects.

Higher values can be interpreted as lower priority. As a consequence, the object with the lowest value has highest priority (somewhat analogous to Servlet "load-on-startup" values).

Specified by:
getOrder in interface Ordered
Returns:
the order value

getAspectName

public java.lang.String getAspectName()
Description copied from interface: AspectJPrecedenceInformation
The name of the aspect (bean) in which the advice was declared.

Specified by:
getAspectName in interface AspectJPrecedenceInformation

getDeclarationOrder

public int getDeclarationOrder()
Description copied from interface: AspectJPrecedenceInformation
The declaration order of the advice member within the aspect.

Specified by:
getDeclarationOrder in interface AspectJPrecedenceInformation

isBeforeAdvice

public boolean isBeforeAdvice()
Description copied from interface: AspectJPrecedenceInformation
Return whether this is a before advice.

Specified by:
isBeforeAdvice in interface AspectJPrecedenceInformation

isAfterAdvice

public boolean isAfterAdvice()
Description copied from interface: AspectJPrecedenceInformation
Return whether this is an after advice.

Specified by:
isAfterAdvice in interface AspectJPrecedenceInformation

determineAdviceType

private void determineAdviceType()
Duplicates some logic from getAdvice, but importantly does not force creation of the advice.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object