org.springframework.aop.aspectj.annotation
Class ReflectiveAspectJAdvisorFactory

java.lang.Object
  extended by org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory
      extended by org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory
All Implemented Interfaces:
AspectJAdvisorFactory

public class ReflectiveAspectJAdvisorFactory
extends AbstractAspectJAdvisorFactory

Factory that can create Spring AOP Advisors given AspectJ classes from classes honoring the AspectJ 5 annotation syntax, using reflection to invoke the corresponding advice methods.

Since:
2.0
Author:
Rod Johnson, Adrian Colyer, Juergen Hoeller, Ramnivas Laddad

Nested Class Summary
protected static class ReflectiveAspectJAdvisorFactory.SyntheticInstantiationAdvisor
          Synthetic advisor that instantiates the aspect.
 
Nested classes/interfaces inherited from class org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory
AbstractAspectJAdvisorFactory.AspectJAnnotation<A extends Annotation>, AbstractAspectJAdvisorFactory.AspectJAnnotationType
 
Field Summary
 
Fields inherited from class org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory
ASPECTJ_ANNOTATION_PARAMETER_NAME_DISCOVERER, logger, parameterNameDiscoverer
 
Constructor Summary
ReflectiveAspectJAdvisorFactory()
           
 
Method Summary
 Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut ajexp, MetadataAwareAspectInstanceFactory aif, int declarationOrderInAspect, String aspectName)
          Build a Spring AOP Advice for the given AspectJ advice method.
 Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aif, int declarationOrderInAspect, String aspectName)
          Build a Spring AOP Advisor for the given AspectJ advice method.
 List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory maaif)
          Build Spring AOP Advisors for all annotated At-AspectJ methods on the specified aspect instance.
 
Methods inherited from class org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory
createPointcutExpression, findAspectJAnnotationOnMethod, isAspect, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectiveAspectJAdvisorFactory

public ReflectiveAspectJAdvisorFactory()
Method Detail

getAdvisors

public List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory maaif)
Description copied from interface: AspectJAdvisorFactory
Build Spring AOP Advisors for all annotated At-AspectJ methods on the specified aspect instance.

Parameters:
maaif - the aspect instance factory (not the aspect instance itself in order to avoid eager instantiation)
Returns:
a list of advisors for this class

getAdvisor

public Advisor getAdvisor(Method candidateAdviceMethod,
                          MetadataAwareAspectInstanceFactory aif,
                          int declarationOrderInAspect,
                          String aspectName)
Description copied from interface: AspectJAdvisorFactory
Build a Spring AOP Advisor for the given AspectJ advice method.

Parameters:
candidateAdviceMethod - the candidate advice method
aif - the aspect instance factory
declarationOrderInAspect - the declaration order within the aspect
aspectName - the name of the aspect
Returns:
null if the method is not an AspectJ advice method or if it is a pointcut that will be used by other advice but will not create a Spring advice in its own right

getAdvice

public Advice getAdvice(Method candidateAdviceMethod,
                        AspectJExpressionPointcut ajexp,
                        MetadataAwareAspectInstanceFactory aif,
                        int declarationOrderInAspect,
                        String aspectName)
Description copied from interface: AspectJAdvisorFactory
Build a Spring AOP Advice for the given AspectJ advice method.

Parameters:
candidateAdviceMethod - the candidate advice method
ajexp - the corresponding AspectJ expression pointcut
aif - the aspect instance factory
declarationOrderInAspect - the declaration order within the aspect
aspectName - the name of the aspect
Returns:
null if the method is not an AspectJ advice method or if it is a pointcut that will be used by other advice but will not create a Spring advice in its own right
See Also:
AspectJAroundAdvice, AspectJMethodBeforeAdvice, AspectJAfterAdvice, AspectJAfterReturningAdvice, AspectJAfterThrowingAdvice