/** * 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. The reason for this latter test * is that aspects written in the code-style (AspectJ language) also have the annotation present * when compiled by ajc with the -1.5 flag, yet they cannot be consumed by Spring AOP. */ @Override public boolean isAspect(Class<?> clazz) { return (hasAspectAnnotation(clazz) && !compiledByAjc(clazz)); }
/** * Find and return the first AspectJ annotation on the given method * (there <i>should</i> only be one anyway...). */ @SuppressWarnings("unchecked") @Nullable protected static AspectJAnnotation<?> findAspectJAnnotationOnMethod(Method method) { for (Class<?> clazz : ASPECTJ_ANNOTATION_CLASSES) { AspectJAnnotation<?> foundAnnotation = findAnnotation(method, (Class<Annotation>) clazz); if (foundAnnotation != null) { return foundAnnotation; } } return null; }
@Override @Nullable public String[] getParameterNames(Method method) { if (method.getParameterCount() == 0) { return new String[0]; } AspectJAnnotation<?> annotation = findAspectJAnnotationOnMethod(method); if (annotation == null) { return null; } StringTokenizer nameTokens = new StringTokenizer(annotation.getArgumentNames(), ","); if (nameTokens.countTokens() > 0) { String[] names = new String[nameTokens.countTokens()]; for (int i = 0; i < names.length; i++) { names[i] = nameTokens.nextToken(); } return names; } else { return null; } }
/** * 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. The reason for this latter test * is that aspects written in the code-style (AspectJ language) also have the annotation present * when compiled by ajc with the -1.5 flag, yet they cannot be consumed by Spring AOP. */ @Override public boolean isAspect(Class<?> clazz) { return (hasAspectAnnotation(clazz) && !compiledByAjc(clazz)); }
AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(this.aspectJAdviceMethod); if (aspectJAnnotation == null) { this.isBeforeAdvice = false;
/** * Find and return the first AspectJ annotation on the given method * (there <i>should</i> only be one anyway...). */ @SuppressWarnings("unchecked") protected static AspectJAnnotation<?> findAspectJAnnotationOnMethod(Method method) { for (Class<?> clazz : ASPECTJ_ANNOTATION_CLASSES) { AspectJAnnotation<?> foundAnnotation = findAnnotation(method, (Class<Annotation>) clazz); if (foundAnnotation != null) { return foundAnnotation; } } return null; }
/** * 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. The reason for this latter test * is that aspects written in the code-style (AspectJ language) also have the annotation present * when compiled by ajc with the -1.5 flag, yet they cannot be consumed by Spring AOP. */ @Override public boolean isAspect(Class<?> clazz) { return (hasAspectAnnotation(clazz) && !compiledByAjc(clazz)); }
@Nullable private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) { AspectJAnnotation<?> aspectJAnnotation = AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod); if (aspectJAnnotation == null) { return null; } AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(candidateAspectClass, new String[0], new Class<?>[0]); ajexp.setExpression(aspectJAnnotation.getPointcutExpression()); if (this.beanFactory != null) { ajexp.setBeanFactory(this.beanFactory); } return ajexp; }
/** * Find and return the first AspectJ annotation on the given method * (there <i>should</i> only be one anyway...). */ @SuppressWarnings("unchecked") @Nullable protected static AspectJAnnotation<?> findAspectJAnnotationOnMethod(Method method) { for (Class<?> clazz : ASPECTJ_ANNOTATION_CLASSES) { AspectJAnnotation<?> foundAnnotation = findAnnotation(method, (Class<Annotation>) clazz); if (foundAnnotation != null) { return foundAnnotation; } } return null; }
AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod); if (aspectJAnnotation == null) { return null;
@Override public String[] getParameterNames(Method method) { if (method.getParameterTypes().length == 0) { return new String[0]; } AspectJAnnotation<?> annotation = findAspectJAnnotationOnMethod(method); if (annotation == null) { return null; } StringTokenizer nameTokens = new StringTokenizer(annotation.getArgumentNames(), ","); if (nameTokens.countTokens() > 0) { String[] names = new String[nameTokens.countTokens()]; for (int i = 0; i < names.length; i++) { names[i] = nameTokens.nextToken(); } return names; } else { return null; } }
@Override @Nullable public String[] getParameterNames(Method method) { if (method.getParameterCount() == 0) { return new String[0]; } AspectJAnnotation<?> annotation = findAspectJAnnotationOnMethod(method); if (annotation == null) { return null; } StringTokenizer nameTokens = new StringTokenizer(annotation.getArgumentNames(), ","); if (nameTokens.countTokens() > 0) { String[] names = new String[nameTokens.countTokens()]; for (int i = 0; i < names.length; i++) { names[i] = nameTokens.nextToken(); } return names; } else { return null; } }
AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(this.aspectJAdviceMethod); if (aspectJAnnotation == null) { this.isBeforeAdvice = false;
AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(this.aspectJAdviceMethod); if (aspectJAnnotation == null) { this.isBeforeAdvice = false;
@Nullable private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) { AspectJAnnotation<?> aspectJAnnotation = AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod); if (aspectJAnnotation == null) { return null; } AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(candidateAspectClass, new String[0], new Class<?>[0]); ajexp.setExpression(aspectJAnnotation.getPointcutExpression()); if (this.beanFactory != null) { ajexp.setBeanFactory(this.beanFactory); } return ajexp; }
AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod); if (aspectJAnnotation == null) { return null;
AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod); if (aspectJAnnotation == null) { return null;