code: public static <T extends Annotation> T getAnnotation(AnnotatedElement ae, Class<T> annotationType) {
      T ann = ae.getAnnotation(annotationType);
      if (ann == null) {
        for (Annotation metaAnn : ae.getAnnotations()) {
          ann = metaAnn.annotationType().getAnnotation(annotationType);
          if (ann != null) {
            break;
          }
        }
      }
      return ann;
    }
docs: Get a single {@link java.lang.annotation.Annotation} of {@code annotationType} from the supplied
  Method, Constructor or Field. Meta-annotations will be searched if the annotation
  is not declared locally on the supplied element.
  @param ae the Method, Constructor or Field from which to get the annotation
  @param annotationType the annotation class to look for, both locally and as a meta-annotation
  @param <T> annotation type
  @return the matching annotation or {@code null} if not found
  @since 3.1