code: public static boolean isAnnotationDeclaredLocally(Class<? extends Annotation> annotationType, Class<?> clazz) {
      boolean declaredLocally = false;
      for (Annotation annotation : clazz.getDeclaredAnnotations()) {
        if (annotation.annotationType().equals(annotationType)) {
          declaredLocally = true;
          break;
        }
      }
      return declaredLocally;
    }
docs: Determine whether an annotation for the specified {@code annotationType} is
  declared locally on the supplied {@code clazz}. The supplied {@link Class}
  may represent any type.
  <p>Note: This method does <strong>not</strong> determine if the annotation is
  {@linkplain java.lang.annotation.Inherited inherited}. For greater clarity
  regarding inherited annotations, consider using
  {@link #isAnnotationInherited(Class, Class)} instead.
  @param annotationType the Class object corresponding to the annotation type
  @param clazz the Class object corresponding to the class on which to check for the annotation
  @return {@code true} if an annotation for the specified {@code annotationType}
  is declared locally on the supplied {@code clazz}
  @see Class#getDeclaredAnnotations()
  @see #isAnnotationInherited(Class, Class)