org.springframework.aop.support.annotation
public class: AnnotationMethodMatcher [javadoc |
source]
java.lang.Object
org.springframework.aop.support.StaticMethodMatcher
org.springframework.aop.support.annotation.AnnotationMethodMatcher
All Implemented Interfaces:
MethodMatcher
Simple MethodMatcher that looks for a specific Java 5 annotation
being present on a method (checking both the method on the invoked
interface, if any, and the corresponding method on the target class).
| Constructor: |
public AnnotationMethodMatcher(Class annotationType) {
Assert.notNull(annotationType, "Annotation type must not be null");
this.annotationType = annotationType;
}
Create a new AnnotationClassFilter for the given annotation type. Parameters:
annotationType - the annotation type to look for
|
| Method from org.springframework.aop.support.annotation.AnnotationMethodMatcher Summary: |
|---|
|
matches |
| Methods from org.springframework.aop.support.StaticMethodMatcher: |
|---|
|
isRuntime, matches |
| Method from org.springframework.aop.support.annotation.AnnotationMethodMatcher Detail: |
public boolean matches(Method method,
Class targetClass) {
if (method.isAnnotationPresent(this.annotationType)) {
return true;
}
// The method may be on an interface, so let's check on the target class as well.
Method specificMethod = AopUtils.getMostSpecificMethod(method, targetClass);
return (specificMethod != method && specificMethod.isAnnotationPresent(this.annotationType));
}
|