com.vocalabs.egtest.processor.data.AnnotationReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of egtest-processor Show documentation
Show all versions of egtest-processor Show documentation
Java annotation processor for turning EgTest annotations into JUnit tests.
package com.vocalabs.egtest.processor.data;
import com.vocalabs.egtest.processor.AnnotationCollector;
import com.vocalabs.egtest.processor.MessageHandler;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.Element;
import java.lang.annotation.Annotation;
import java.util.List;
import java.util.Set;
public interface AnnotationReader> {
default void addExamples(RoundEnvironment roundEnvironment, AnnotationCollector collector) {
MessageHandler messageHandler = collector.getMessageHandler();
for (Class extends Annotation> annotationClass: supportedAnnotationClasses()) {
for (Element el: roundEnvironment.getElementsAnnotatedWith(annotationClass)) {
for (E example: examples(el.getAnnotation(annotationClass), el, messageHandler)) {
collector.add(example);
}
}
}
}
/** Every annotation has exactly one factory to handle it. */
Set> supportedAnnotationClasses();
/**
* Checks to see if this element has a matching examples.
* @param annotation must be a supported annotation type
*/
List examples(Annotation annotation, Element element, MessageHandler messageHandler);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy