站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

AspectJAdvisorFactory (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.aop.aspectj.annotation
Interface AspectJAdvisorFactory

All Known Implementing Classes:
AbstractAspectJAdvisorFactory, ReflectiveAspectJAdvisorFactory

public interface AspectJAdvisorFactory

Interface for factories that can create Spring AOP Advisors from classes annotated with AspectJ annotation syntax.

Since:
2.0
Author:
Rod Johnson, Juergen Hoeller
See Also:
AspectMetadata, AjTypeSystem

Method Summary
 Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut pointcut, 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 aif)
          Build Spring AOP Advisors for all annotated At-AspectJ methods on the specified aspect instance.
 boolean isAspect(Class<?> clazz)
          Determine whether or not the given class is an aspect, as reported by AspectJ's AjTypeSystem.
 void validate(Class<?> aspectClass)
          Is the given class a valid AspectJ aspect class?
 

Method Detail

isAspect

boolean isAspect(Class<?> clazz)
Determine whether or not the given class is an aspect, as reported by AspectJ's 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(java.lang.Class) method to handle these cases if necessary.

Parameters:
clazz - the supposed annotation-style AspectJ class
Returns:
whether or not this class is recognized by AspectJ as an aspect class

validate

void validate(Class<?> aspectClass)
              throws AopConfigException
Is the given class a valid AspectJ aspect class?

Parameters:
aspectClass - the supposed AspectJ annotation-style class to validate
Throws:
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)

getAdvisors

List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory aif)
Build Spring AOP Advisors for all annotated At-AspectJ methods on the specified aspect instance.

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

getAdvisor

Advisor getAdvisor(Method candidateAdviceMethod,
                   MetadataAwareAspectInstanceFactory aif,
                   int declarationOrderInAspect,
                   String aspectName)
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

Advice getAdvice(Method candidateAdviceMethod,
                 AspectJExpressionPointcut pointcut,
                 MetadataAwareAspectInstanceFactory aif,
                 int declarationOrderInAspect,
                 String aspectName)
Build a Spring AOP Advice for the given AspectJ advice method.

Parameters:
candidateAdviceMethod - the candidate advice method
pointcut - 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

The Spring Framework

Copyright © 2002-2007 The Spring Framework.