Browse Source

AnnotationUtils.getAnnotation generally supports meta-annotation lookup

pull/23217/head
Juergen Hoeller 17 years ago
parent
commit
dbdd6eca60
  1. 12
      org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java

12
org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java

@ -75,7 +75,17 @@ public abstract class AnnotationUtils { @@ -75,7 +75,17 @@ public abstract class AnnotationUtils {
* @see org.springframework.core.BridgeMethodResolver#findBridgedMethod(Method)
*/
public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
return BridgeMethodResolver.findBridgedMethod(method).getAnnotation(annotationType);
Method resolvedMethod = BridgeMethodResolver.findBridgedMethod(method);
A ann = resolvedMethod.getAnnotation(annotationType);
if (ann == null) {
for (Annotation metaAnn : resolvedMethod.getAnnotations()) {
ann = metaAnn.annotationType().getAnnotation(annotationType);
if (ann != null) {
break;
}
}
}
return ann;
}
/**

Loading…
Cancel
Save