All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vocalabs.egtest.processor.data.AnnotationReader Maven / Gradle / Ivy

There is a newer version: 0.3.0
Show newest version
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 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