code: public static void callAnnotated(Object o, Class<? extends Annotation> ann, boolean lazy) {
          try {
              getMethodOfInterest(o, ann).invoke(o);
          } catch (IllegalAccessException ex) {
              throw new RuntimeException(ex);
          } catch (InvocationTargetException ex) {
              throw new RuntimeException(ex.getCause());
          } catch (IllegalArgumentException ex) {
              if (!lazy) {
                  throw new RuntimeException(ex.getMessage());
              }
          }
      }
docs: Call an method by Annotation.
  
  @param o the object to call.
  @param ann the annotation
  @param lazy if true, the a missing annotation is OK. if false
  the annotation has to be present or a Runtime exception is thrown.