Top Description Inners Fields Constructors Methods
org.springframework.aop.aspectj.annotation

public Class ReflectiveAspectJAdvisorFactory

extends AbstractAspectJAdvisorFactory
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@SuppressWarnings:serial
Imports
java.io.Serializable, java.lang.annotation.Annotation, java.lang.reflect.Field, .Method, java.util.ArrayList, .Comparator, .List, org.aopalliance.aop.Advice, org.aspectj.lang.annotation.After, .AfterReturning, .AfterThrowing, .Around, .Before, .DeclareParents, .Pointcut, org.springframework.aop.Advisor, .MethodBeforeAdvice, org.springframework.aop.aspectj.AbstractAspectJAdvice, .AspectJAfterAdvice, .AspectJAfterReturningAdvice, .AspectJAfterThrowingAdvice, .AspectJAroundAdvice, .AspectJExpressionPointcut, .AspectJMethodBeforeAdvice, .DeclareParentsAdvisor, org.springframework.aop.framework.AopConfigException, org.springframework.aop.support.DefaultPointcutAdvisor, org.springframework.beans.factory.BeanFactory, org.springframework.core.annotation.AnnotationUtils, org.springframework.core.convert.converter.Converter, .ConvertingComparator, org.springframework.lang.Nullable, org.springframework.util.ReflectionUtils, .ReflectionUtils.MethodFilter, .StringUtils, org.springframework.util.comparator.InstanceComparator

Factory that can create Spring AOP Advisors given AspectJ classes from classes honoring AspectJ's annotation syntax, using reflection to invoke the corresponding advice methods.
Authors
Rod Johnson, Adrian Colyer, Juergen Hoeller, Ramnivas Laddad, Phillip Webb, Sam Brannen
Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
ReflectiveAspectJAdvisorFactory.SyntheticInstantiationAdvisor

Synthetic advisor that instantiates the aspect.

Field Summary

Modifier and TypeField and Description
private static final Comparator<Method>
private static final ReflectionUtils.MethodFilter
private final BeanFactory
Inherited from org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory:
loggerparameterNameDiscoverer

Constructor Summary

AccessConstructor and Description
public
ReflectiveAspectJAdvisorFactory()

Create a new ReflectiveAspectJAdvisorFactory.

public
ReflectiveAspectJAdvisorFactory(BeanFactory
the BeanFactory to propagate (may be null}
beanFactory
)

Create a new ReflectiveAspectJAdvisorFactory, propagating the given BeanFactory to the created AspectJExpressionPointcut instances, for bean pointcut handling as well as consistent ClassLoader resolution.

Method Summary

Modifier and TypeMethod and Description
public Advice
getAdvice(Method
the candidate advice method
candidateAdviceMethod
,
AspectJExpressionPointcut
the AspectJ expression pointcut
expressionPointcut
,
MetadataAwareAspectInstanceFactory
the aspect instance factory
aspectInstanceFactory
,
int
the declaration order within the aspect
declarationOrder
,
String
the name of the aspect
aspectName
)

Implements org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory.getAdvice.

Build a Spring AOP Advice for the given AspectJ advice method.
public Advisor
getAdvisor(Method
the candidate advice method
candidateAdviceMethod
,
MetadataAwareAspectInstanceFactory
the aspect instance factory
aspectInstanceFactory
,
int
the declaration order within the aspect
declarationOrderInAspect
,
String
the name of the aspect
aspectName
)

Implements org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory.getAdvisor.

Build a Spring AOP Advisor for the given AspectJ advice method.
private List<Method>
getAdvisorMethods(Class<?> aspectClass)

public List<Advisor>
getAdvisors(MetadataAwareAspectInstanceFactory
the aspect instance factory (not the aspect instance itself in order to avoid eager instantiation)
aspectInstanceFactory
)

Implements org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory.getAdvisors.

Build Spring AOP Advisors for all annotated At-AspectJ methods on the specified aspect instance.
private Advisor

Returns:

the Advisor instance, or null if not an Advisor
getDeclareParentsAdvisor
(Field
the field to introspect
introductionField
)

Build a org.springframework.aop.aspectj.DeclareParentsAdvisor for the given introduction field.

private AspectJExpressionPointcut
getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass)

Inherited from org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory:
compiledByAjcfindAspectJAnnotationOnMethodisAspectvalidate

Field Detail

adviceMethodComparatorback to summary
private static final Comparator<Method> adviceMethodComparator
adviceMethodFilterback to summary
private static final ReflectionUtils.MethodFilter adviceMethodFilter
beanFactoryback to summary
private final BeanFactory beanFactory
Annotations
@Nullable

Constructor Detail

ReflectiveAspectJAdvisorFactoryback to summary
public ReflectiveAspectJAdvisorFactory()

Create a new ReflectiveAspectJAdvisorFactory.

ReflectiveAspectJAdvisorFactoryback to summary
public ReflectiveAspectJAdvisorFactory(BeanFactory beanFactory)

Create a new ReflectiveAspectJAdvisorFactory, propagating the given BeanFactory to the created AspectJExpressionPointcut instances, for bean pointcut handling as well as consistent ClassLoader resolution.

Parameters
beanFactory:BeanFactory

the BeanFactory to propagate (may be null}

Since
4.3.6
See Also
AspectJExpressionPointcut#setBeanFactory, org.springframework.beans.factory.config.ConfigurableBeanFactory#getBeanClassLoader()

Method Detail

getAdviceback to summary
public Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut expressionPointcut, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName)

Implements org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory.getAdvice.

Doc from org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory.getAdvice.

Build a Spring AOP Advice for the given AspectJ advice method.

Parameters
candidateAdviceMethod:Method

the candidate advice method

expressionPointcut:AspectJExpressionPointcut

the AspectJ expression pointcut

aspectInstanceFactory:MetadataAwareAspectInstanceFactory

the aspect instance factory

declarationOrder:int

the declaration order within the aspect

aspectName:String

the name of the aspect

Returns:Advice

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

Annotations
@Override
@Nullable
getAdvisorback to summary
public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrderInAspect, String aspectName)

Implements org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory.getAdvisor.

Doc from org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory.getAdvisor.

Build a Spring AOP Advisor for the given AspectJ advice method.

Parameters
candidateAdviceMethod:Method

the candidate advice method

aspectInstanceFactory:MetadataAwareAspectInstanceFactory

the aspect instance factory

declarationOrderInAspect:int

the declaration order within the aspect

aspectName:String

the name of the aspect

Returns:Advisor

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

Annotations
@Override
@Nullable
getAdvisorMethodsback to summary
private List<Method> getAdvisorMethods(Class<?> aspectClass)
getAdvisorsback to summary
public List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory aspectInstanceFactory)

Implements org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory.getAdvisors.

Doc from org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory.getAdvisors.

Build Spring AOP Advisors for all annotated At-AspectJ methods on the specified aspect instance.

Parameters
aspectInstanceFactory:MetadataAwareAspectInstanceFactory

the aspect instance factory (not the aspect instance itself in order to avoid eager instantiation)

Returns:List<Advisor>

a list of advisors for this class

Annotations
@Override
getDeclareParentsAdvisorback to summary
private Advisor getDeclareParentsAdvisor(Field introductionField)

Build a org.springframework.aop.aspectj.DeclareParentsAdvisor for the given introduction field.

Resulting Advisors will need to be evaluated for targets.

Parameters
introductionField:Field

the field to introspect

Returns:Advisor

the Advisor instance, or null if not an Advisor

Annotations
@Nullable
getPointcutback to summary
private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass)
Annotations
@Nullable
org.springframework.aop.aspectj.annotation back to summary

protected Class ReflectiveAspectJAdvisorFactory.SyntheticInstantiationAdvisor

extends DefaultPointcutAdvisor
Class Inheritance
Annotations
@SuppressWarnings:serial

Synthetic advisor that instantiates the aspect. Triggered by per-clause pointcut on non-singleton aspect. The advice has no effect.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.springframework.aop.support.DefaultPointcutAdvisor:
getPointcutsetPointcuttoString

Constructor Detail

SyntheticInstantiationAdvisorback to summary
public SyntheticInstantiationAdvisor(final MetadataAwareAspectInstanceFactory aif)