PrintingAnnotationMonitor.java

  1. package org.jbehave.core.configuration;

  2. import java.lang.annotation.Annotation;

  3. public abstract class PrintingAnnotationMonitor implements AnnotationMonitor {

  4.     @Override
  5.     public void elementCreationFailed(Class<?> elementClass, Exception cause) {
  6.         print("Element creation failed: %s", elementClass);
  7.         printStackTrace(cause);
  8.     }

  9.     @Override
  10.     public void annotationNotFound(Class<? extends Annotation> annotation, Object annotatedInstance) {
  11.         print("Annotation %s not found in %s", annotation, annotatedInstance);
  12.     }

  13.     protected abstract void print(String format, Object... args);

  14.     protected abstract void printStackTrace(Throwable e);
  15. }