Top Description Methods
org.springframework.aop.aspectj.annotation

public Interface AspectJAdvisorFactory

Known Direct Implementers
org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory
Imports
java.lang.reflect.Method, java.util.List, org.aopalliance.aop.Advice, org.springframework.aop.Advisor, org.springframework.aop.aspectj.AspectJExpressionPointcut, org.springframework.aop.framework.AopConfigException, org.springframework.lang.Nullable

Interface for factories that can create Spring AOP Advisors from classes annotated with AspectJ annotation syntax.
Authors
Rod Johnson, Juergen Hoeller
Since
2.0
See Also
AspectMetadata, org.aspectj.lang.reflect.AjTypeSystem

Method Summary

Modifier and TypeMethod and Description
public Advice

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
(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
)

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

public Advisor

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
getAdvisor
(Method
the candidate advice method
candidateAdviceMethod
,
MetadataAwareAspectInstanceFactory
the aspect instance factory
aspectInstanceFactory
,
int
the declaration order within the aspect
declarationOrder
,
String
the name of the aspect
aspectName
)

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

public List<Advisor>

Returns:

a list of advisors for this class
getAdvisors
(MetadataAwareAspectInstanceFactory
the aspect instance factory (not the aspect instance itself in order to avoid eager instantiation)
aspectInstanceFactory
)

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

public boolean

Returns:

whether this class is recognized by AspectJ as an aspect class
isAspect
(Class<?>
the supposed annotation-style AspectJ class
clazz
)

Determine whether the given class is an aspect, as reported by AspectJ's org.aspectj.lang.reflect.AjTypeSystem.

public void
validate(Class<?>
the supposed AspectJ annotation-style class to validate
aspectClass
)

Is the given class a valid AspectJ aspect class?

Method Detail

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

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
@Nullable
See Also
org.springframework.aop.aspectj.AspectJAroundAdvice, org.springframework.aop.aspectj.AspectJMethodBeforeAdvice, org.springframework.aop.aspectj.AspectJAfterAdvice, org.springframework.aop.aspectj.AspectJAfterReturningAdvice, org.springframework.aop.aspectj.AspectJAfterThrowingAdvice
getAdvisorback to summary
public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName)

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

Parameters
candidateAdviceMethod:Method

the candidate advice method

aspectInstanceFactory:MetadataAwareAspectInstanceFactory

the aspect instance factory

declarationOrder: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
@Nullable
getAdvisorsback to summary
public List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory aspectInstanceFactory)

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

isAspectback to summary
public boolean isAspect(Class<?> clazz)

Determine whether the given class is an aspect, as reported by AspectJ's org.aspectj.lang.reflect.AjTypeSystem.

Will simply return false if the supposed aspect is invalid (such as an extension of a concrete aspect class). Will return true for some aspects that Spring AOP cannot process, such as those with unsupported instantiation models. Use the validate method to handle these cases if necessary.

Parameters
clazz:Class<?>

the supposed annotation-style AspectJ class

Returns:boolean

whether this class is recognized by AspectJ as an aspect class

validateback to summary
public void validate(Class<?> aspectClass) throws AopConfigException

Is the given class a valid AspectJ aspect class?

Parameters
aspectClass:Class<?>

the supposed AspectJ annotation-style class to validate

Exceptions
AopConfigException:
if the class is an invalid aspect (which can never be legal)
NotAnAtAspectException:
if the class is not an aspect at all (which may or may not be legal, depending on the context)