br.com.jarch.apt.processor.JArchGenerateLogicCrudProcessor Maven / Gradle / Ivy
package br.com.jarch.apt.processor;
import br.com.jarch.annotation.JArchGenerateLogicCrud;
import br.com.jarch.util.ProcessorUtils;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
import java.util.Set;
@SupportedAnnotationTypes({"br.com.jarch.annotation.JArchGenerateLogicCrud", "br.com.jarch.annotation.JArchGenerateLogicCrud.List"})
public class JArchGenerateLogicCrudProcessor extends AbstractProcessor {
@Override
public boolean process(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
ProcessorUtils.processingEnvironment = processingEnv;
try {
ProcessorUtils.messageMandatoryWarning("Processando: " + getClass().getSimpleName());
roundEnv
.getElementsAnnotatedWithAny(Set.of(JArchGenerateLogicCrud.class, JArchGenerateLogicCrud.List.class))
.forEach(element -> new LogicCrud(element).generate());
return false;
} catch (Exception ex) {
ProcessorUtils.messageError(ex.getMessage());
return true;
}
}
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latest();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy