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

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

The newest version!
package br.com.jarch.apt.processor;

import br.com.jarch.apt.util.ProcessorUtils;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.enterprise.context.RequestScoped;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
import java.util.Set;

@SupportedAnnotationTypes(value = "javax.enterprise.context.RequestScoped")
public class JsfRequestScopedProcessor extends AbstractProcessor {
    @Override
    public boolean process(final Set annotations, final RoundEnvironment roundEnv) {
        try {
            ProcessorUtils.processingEnvironment = processingEnv;
            ProcessorUtils.messageNote("Analyzing: " + getClass().getSimpleName());

            roundEnv
                    .getElementsAnnotatedWith(RequestScoped.class)
                    .forEach(element -> {
                        ProcessorUtils.messageAnalyzing(getClass(), element);
                        ProcessorUtils.validCdiNoSerializable(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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy