code: public static <A extends Annotation> A getAnnotation(final Method method, final Class<A> annotationCls,
                                                           final boolean searchSupers, final boolean ignoreAccess) {
  
          Validate.isTrue(method != null, "The method must not be null");
          Validate.isTrue(annotationCls != null, "The annotation class must not be null");
          if (!ignoreAccess && !MemberUtils.isAccessible(method)) {
              return null;
          }
  
          A annotation = method.getAnnotation(annotationCls);
  
          if (annotation == null && searchSupers) {
              final Class<?> mcls = method.getDeclaringClass();
              final List<Class<?>> classes = getAllSuperclassesAndInterfaces(mcls);
              for (final Class<?> acls : classes) {
                  Method equivalentMethod;
                  try {
                      equivalentMethod = (ignoreAccess ? acls.getDeclaredMethod(method.getName(), method.getParameterTypes())
                              : acls.getMethod(method.getName(), method.getParameterTypes()));
                  } catch (final NoSuchMethodException e) {
                      // if not found, just keep searching
                      continue;
                  }
                  annotation = equivalentMethod.getAnnotation(annotationCls);
                  if (annotation != null) {
                      break;
                  }
              }
          }
  
          return annotation;
      }
docs: <p>Gets the annotation object with the given annotation type that is present on the given method
  or optionally on any equivalent method in super classes and interfaces. Returns null if the annotation
  type was not present.</p>
  
  <p>Stops searching for an annotation once the first annotation of the specified type has been
  found. Additional annotations of the specified type will be silently ignored.</p>
  @param <A>
  the annotation type
  @param method
  the {@link Method} to query
  @param annotationCls
  the {@link Annotation} to check if is present on the method
  @param searchSupers
  determines if a lookup in the entire inheritance hierarchy of the given class is performed
  if the annotation was not directly present
  @param ignoreAccess
  determines if underlying method has to be accessible
  @return the first matching annotation, or {@code null} if not found
  @throws IllegalArgumentException
  if the method or annotation are {@code null}
  @since 3.6