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

br.com.jarch.apt.processor.ManyToManyProcessor Maven / Gradle / Ivy

There is a newer version: 24.9.0
Show newest version
package br.com.jarch.apt.processor;

import br.com.jarch.util.ProcessorUtils;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Completion;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.persistence.ManyToMany;
import java.util.Set;

@SupportedAnnotationTypes("javax.persistence.ManyToMany")
public class ManyToManyProcessor extends AbstractProcessor {

    @Override
    public boolean process(final Set annotations, final RoundEnvironment roundEnv) {
        ProcessorUtils.processingEnvironment = processingEnv;
	ProcessorUtils.messageMandatoryWarning("Processando: " + getClass().getSimpleName());

        try {
            roundEnv
                    .getElementsAnnotatedWith(ManyToMany.class)
                    .stream()
                    .forEach(element -> {
                        ProcessorUtils.messageAnalyzing(getClass(), element);
                        ProcessorUtils.validFilterTenant(element);
                    });

        } catch (Exception ex) {
            ProcessorUtils.messageError("JARCH ERROR: Erro no APT " + getClass().getSimpleName() + " Mensagem: " + ex.getMessage());
        }

        return false;
    }

    @Override
    public SourceVersion getSupportedSourceVersion() {
        return SourceVersion.latest();
    }

//    @Override
//    public Iterable getCompletions(Element element,
//                                                         AnnotationMirror annotation,
//                                                         ExecutableElement member,
//                                                         String userText) {
//
//        return ProcessorUtils.getCompletionsFilterTenantLogicExclusion();
//    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy