Example usage for javax.annotation.processing Messager printMessage

List of usage examples for javax.annotation.processing Messager printMessage

Introduction

In this page you can find the example usage for javax.annotation.processing Messager printMessage.

Prototype

void printMessage(Diagnostic.Kind kind, CharSequence msg);

Source Link

Document

Prints a message of the specified kind.

Usage

From source file:org.kie.workbench.common.stunner.core.processors.MainProcessor.java

private boolean processLastRoundPropertySetAdapter(final Set<? extends TypeElement> set,
        final RoundEnvironment roundEnv) throws Exception {
    final Messager messager = processingEnv.getMessager();
    try {/*from   w w  w. j  av  a 2  s.  co m*/
        // Ensure visible on both backend and client sides.
        final String packageName = getGeneratedPackageName() + ".definition.adapter.binding";
        final String className = getSetClassPrefix() + PROPERTYSET_ADAPTER_CLASSNAME;
        final String classFQName = packageName + "." + className;
        messager.printMessage(Diagnostic.Kind.NOTE, "Starting ErraiBinderAdapter adf named " + classFQName);
        final StringBuffer ruleClassCode = propertySetAdapterGenerator.generate(packageName, className,
                processingContext.getPropertySetAnnotations(), messager);
        writeCode(packageName, className, ruleClassCode);
    } catch (GenerationException ge) {
        final String msg = ge.getMessage();
        processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, msg);
    }
    return true;
}

From source file:org.kie.workbench.common.stunner.core.processors.MainProcessor.java

private boolean processLastRoundDefinitionFactory(final Set<? extends TypeElement> set,
        final RoundEnvironment roundEnv) throws Exception {
    final Messager messager = processingEnv.getMessager();
    try {/*from   w  w  w .j av  a 2 s  . c  o m*/
        final int size = processingContext.getDefinitionAnnotations().getBuilderFieldNames().size()
                + processingContext.getDefSetAnnotations().getBuilderFieldNames().size();
        if (size > 0) {
            final Map<String, String> buildersMap = new LinkedHashMap<>();
            if (!processingContext.getDefinitionAnnotations().getBuilderFieldNames().isEmpty()) {
                buildersMap.putAll(processingContext.getDefinitionAnnotations().getBuilderFieldNames());
            }
            if (!processingContext.getDefSetAnnotations().getBuilderFieldNames().isEmpty()) {
                buildersMap.putAll(processingContext.getDefSetAnnotations().getBuilderFieldNames());
            }
            // Ensure visible on both backend and client sides.
            final String packageName = getGeneratedPackageName() + ".definition.factory";
            final String className = getSetClassPrefix() + DEFINITION_FACTORY_CLASSNAME;
            final String classFQName = packageName + "." + className;
            messager.printMessage(Diagnostic.Kind.NOTE,
                    "Starting ModelFactory adf for class named " + classFQName);
            final StringBuffer ruleClassCode = generatedDefinitionFactoryGenerator.generate(packageName,
                    className, buildersMap, messager);
            writeCode(packageName, className, ruleClassCode);
        }
    } catch (GenerationException ge) {
        final String msg = ge.getMessage();
        processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, msg);
    }
    return true;
}

From source file:org.kie.workbench.common.stunner.core.processors.MainProcessor.java

private boolean processLastRoundDefinitionAdapter(final Set<? extends TypeElement> set,
        final RoundEnvironment roundEnv) throws Exception {
    final Messager messager = processingEnv.getMessager();
    try {/*from  ww  w  . java 2 s. c om*/
        // Ensure visible on both backend and client sides.
        final String packageName = getGeneratedPackageName() + ".definition.adapter.binding";
        final String className = getSetClassPrefix() + DEFINITION_ADAPTER_CLASSNAME;
        final String classFQName = packageName + "." + className;
        messager.printMessage(Diagnostic.Kind.NOTE, "Starting ErraiBinderAdapter adf named " + classFQName);
        final StringBuffer ruleClassCode = definitionAdapterGenerator.generate(packageName, className,
                processingContext, messager);
        writeCode(packageName, className, ruleClassCode);
    } catch (GenerationException ge) {
        final String msg = ge.getMessage();
        processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, msg);
    }
    return true;
}

From source file:org.kie.workbench.common.stunner.core.processors.MainProcessor.java

private boolean processLastRoundPropertyAdapter(final Set<? extends TypeElement> set,
        final RoundEnvironment roundEnv) throws Exception {
    final Messager messager = processingEnv.getMessager();
    try {// w w w .j a v a2 s. co m
        // Ensure visible on both backend and client sides.
        final String packageName = getGeneratedPackageName() + ".definition.adapter.binding";
        final String className = getSetClassPrefix() + PROPERTY_ADAPTER_CLASSNAME;
        final String classFQName = packageName + "." + className;
        messager.printMessage(Diagnostic.Kind.NOTE, "Starting ErraiBinderAdapter adf named " + classFQName);
        final StringBuffer ruleClassCode = propertyAdapterGenerator.generate(packageName, className,
                processingContext.getPropertyAnnotations(), messager);
        writeCode(packageName, className, ruleClassCode);
    } catch (GenerationException ge) {
        final String msg = ge.getMessage();
        processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, msg);
    }
    return true;
}

From source file:org.kie.workbench.common.stunner.core.processors.MainProcessor.java

private void log(Diagnostic.Kind kind, String message) {
    final Messager messager = processingEnv.getMessager();
    messager.printMessage(kind, message);
}