code: public static boolean isAnnotationPresent(final Method m, final Class<? extends Annotation> type)
     {
        boolean result = false;
        if (m.isAnnotationPresent(type))
        {
           result = true;
        }
        else
        {
           for (Annotation a : m.getAnnotations())
           {
              if (isAnnotationPresent(a, type))
              {
                 result = true;
                 break;
              }
           }
        }
  
        if (!result)
        {
           result = isAnnotationPresent(m.getDeclaringClass(), type);
        }
        return result;
     }
docs: Discover if a Method <b>m</b> has been annotated with <b>type</b>.
  
  @param m The method to inspect.
  @param type The targeted annotation class
  @return True if annotation is present either on the method itself, or on the declaring class of the method.
  Returns false if the annotation is not present.