|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory
public abstract class AbstractAspectJAdvisorFactory
Abstract base class for factories that can create Spring AOP Advisors given AspectJ classes from classes honoring the AspectJ 5 annotation syntax.
This class handles annotation parsing and validation functionality. It does not actually generate Spring AOP Advisors, which is deferred to subclasses.
Nested Class Summary | |
---|---|
protected static class |
AbstractAspectJAdvisorFactory.AspectJAnnotation<A extends java.lang.annotation.Annotation>
Class modelling an AspectJ annotation, exposing its type enumeration and pointcut String. |
private static class |
AbstractAspectJAdvisorFactory.AspectJAnnotationParameterNameDiscoverer
ParameterNameDiscoverer implementation that analyzes the arg names specified at the AspectJ annotation level. |
protected static class |
AbstractAspectJAdvisorFactory.AspectJAnnotationType
|
Field Summary | |
---|---|
private static java.lang.String |
AJC_MAGIC
|
protected static ParameterNameDiscoverer |
ASPECTJ_ANNOTATION_PARAMETER_NAME_DISCOVERER
|
protected Log |
logger
Logger available to subclasses |
protected ParameterNameDiscoverer |
parameterNameDiscoverer
|
Constructor Summary | |
---|---|
protected |
AbstractAspectJAdvisorFactory()
|
Method Summary | ||
---|---|---|
private boolean |
compiledByAjc(java.lang.Class<?> clazz)
We need to detect this as "code-style" AspectJ aspects should not be interpreted by Spring AOP. |
|
protected AspectJExpressionPointcut |
createPointcutExpression(java.lang.reflect.Method annotatedMethod,
java.lang.Class declarationScope,
java.lang.String[] pointcutParameterNames)
The pointcut and advice annotations both have an "argNames" member which contains a comma-separated list of the argument names. |
|
private java.lang.Class<?>[] |
extractPointcutParameterTypes(java.lang.String[] argNames,
java.lang.reflect.Method adviceMethod)
Create the pointcut parameters needed by aspectj based on the given argument names and the argument types that are available from the adviceMethod. |
|
private static
|
findAnnotation(java.lang.reflect.Method method,
java.lang.Class<A> toLookFor)
|
|
protected static AbstractAspectJAdvisorFactory.AspectJAnnotation |
findAspectJAnnotationOnMethod(java.lang.reflect.Method method)
Find and return the first AspectJ annotation on the given method (there should only be one anyway...) |
|
private boolean |
hasAspectAnnotation(java.lang.Class<?> clazz)
|
|
boolean |
isAspect(java.lang.Class<?> clazz)
We consider something to be an AspectJ aspect suitable for use by the Spring AOP system if it has the @Aspect annotation, and was not compiled by ajc. |
|
void |
validate(java.lang.Class<?> aspectClass)
Is the given class a valid AspectJ aspect class? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory |
---|
getAdvice, getAdvisor, getAdvisors |
Field Detail |
---|
protected static final ParameterNameDiscoverer ASPECTJ_ANNOTATION_PARAMETER_NAME_DISCOVERER
private static final java.lang.String AJC_MAGIC
protected final Log logger
protected final ParameterNameDiscoverer parameterNameDiscoverer
Constructor Detail |
---|
protected AbstractAspectJAdvisorFactory()
Method Detail |
---|
protected static AbstractAspectJAdvisorFactory.AspectJAnnotation findAspectJAnnotationOnMethod(java.lang.reflect.Method method)
private static <A extends java.lang.annotation.Annotation> AbstractAspectJAdvisorFactory.AspectJAnnotation<A> findAnnotation(java.lang.reflect.Method method, java.lang.Class<A> toLookFor)
public boolean isAspect(java.lang.Class<?> clazz)
isAspect
in interface AspectJAdvisorFactory
clazz
- the supposed annotation-style AspectJ class
private boolean hasAspectAnnotation(java.lang.Class<?> clazz)
private boolean compiledByAjc(java.lang.Class<?> clazz)
public void validate(java.lang.Class<?> aspectClass) throws AopConfigException
AspectJAdvisorFactory
validate
in interface AspectJAdvisorFactory
aspectClass
- the supposed AspectJ annotation-style class to validate
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)protected AspectJExpressionPointcut createPointcutExpression(java.lang.reflect.Method annotatedMethod, java.lang.Class declarationScope, java.lang.String[] pointcutParameterNames)
private java.lang.Class<?>[] extractPointcutParameterTypes(java.lang.String[] argNames, java.lang.reflect.Method adviceMethod)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |