code: public static <T extends Annotation> T declaredAnnotation(
              AnnotatedElement annotatedElement,
              Class<T> annoClass
      ) {
          Annotation[] aa = annotatedElement.getDeclaredAnnotations();
          if (null == aa) {
              return null;
          }
          for (Annotation a : aa) {
              if (annoClass.isInstance(a)) {
                  return (T) a;
              }
          }
          return null;
      }
docs: Return declared annotation with type `annoClass` from
  an {@link AnnotatedElement}.
  
  @param annotatedElement
  the annotated element (could be class, method or field)
  @param annoClass
  the annotation class
  @param <T>
  the generic type of the annotation class
  @return
  the annotation instance or `null` if not found