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

io.jstach.rainbowgum.apt.BuilderModelRenderer Maven / Gradle / Ivy

package io.jstach.rainbowgum.apt;

/**
 * Generated Renderer.
 */
// @javax.annotation.Generated("io.jstach.apt.GenerateRendererProcessor")
class BuilderModelRenderer {
    /**
     * Template path.
     * @hidden
     */
    public static final String TEMPLATE_PATH = "io/jstach/rainbowgum/apt/ConfigBuilder.java";

    /**
     * Inline template string copied.
     * @hidden
     */

    public static final String TEMPLATE_STRING = "";

    /**
     * Template name. Do not rely on this.
     * @hidden
     */
    public static final String TEMPLATE_NAME = "io.jstach.rainbowgum.apt.BuilderModelRenderer";

    /**
     * Template charset.
     * @hidden
     */
    public static final java.nio.charset.Charset TEMPLATE_CHARSET = java.nio.charset.StandardCharsets.UTF_8;

    /**
     * The models class. Use {@link #modelClass()} instead.
     * @hidden
     */
    public static final Class MODEL_CLASS = io.jstach.rainbowgum.apt.BuilderModel.class;

    /**
     * The instance. Use {@link {@link #of()} instead.
     * @hidden
     */
    private static final BuilderModelRenderer INSTANCE = new BuilderModelRenderer();

    /**
     * Formatter. 
     * @hidden
     */
    private final java.util.function.Function formatter;

    /**
     * Escaper. 
     * @hidden
     */
    private final java.util.function.Function escaper;

    /**
     * Renderer constructor for manual wiring.
     * @param formatter formatter if null the static formatter will be used.
     * @param escaper escaper if null the static escaper will be used
     */
    public BuilderModelRenderer(
        java.util.function./* @Nullable */ Function formatter,
        java.util.function./* @Nullable */ Function escaper) {
        super();
        this.formatter = __formatter(formatter);
        this.escaper = __escaper(escaper);
    }

    private static java.util.function.Function __formatter(java.util.function./* @Nullable */ Function formatter) {
        return formatter != null ? formatter : (i -> i.toString());
    }

    private static java.util.function.Function __escaper(java.util.function./* @Nullable */ Function escaper) {
        return escaper != null ? escaper : (i -> i);
    }

    /**
     * Renderer constructor for reflection (use of() instead).
     * For programmatic consider using {@link #of()} for a shared singleton.
     */
    public BuilderModelRenderer() {
        this(null, null);
    }

    /**
     * Renders the passed in model.
     * @param model a model assumed never to be null.
     * @param a the appendable to write to.
     * @throws java.io.IOException if there is an error writing to the appendable
     */
    public void execute(io.jstach.rainbowgum.apt.BuilderModel model, Appendable a) throws java.io.IOException {
        execute(model, a, this.formatter, this.escaper);
    }

    /**
     * Convenience method that directly renders the model as a String.
     * @param model never null.
     * @return the rendered model.
     */
    public String execute(io.jstach.rainbowgum.apt.BuilderModel model) {
        StringBuilder sb = new StringBuilder();
        try {
            execute(model, sb);
        }
        catch(java.io.IOException e) {
            throw new java.io.UncheckedIOException(e);
        }
        return sb.toString();
    }

    /**
     * Renders the passed in model.
     * @param model a model assumed never to be null.
     * @param a appendable to write to.
     * @param formatter formats variables before they are passed to the escaper
     * @param escaper used to write escaped variables
     * @throws java.io.IOException if an error occurs while writing to the appendable
     */
    protected void execute(
        io.jstach.rainbowgum.apt.BuilderModel model, 
        java.lang.Appendable a, 
        java.util.function.Function formatter,
        java.util.function.Function escaper) throws java.io.IOException {
        render(model, a, formatter, escaper);
    }

    /**
     * If this template support the model class
     * @param type model class.
     * @return true if the renderer supports the class
     */
    public boolean supportsType(Class type) {
        return MODEL_CLASS.isAssignableFrom(type);
    }

    /**
     * Template path.
     * @return template path of resource or pseudo inline path
     */
    public String templatePath() {
        return TEMPLATE_PATH;
    }
    /**
     * Logical template name.
     * @return template name
     */
    public String templateName() {
        return TEMPLATE_NAME;
    }
    /**
     * Template charset name.
     * @return charset name of template
     */
    public java.nio.charset.Charset templateCharset() {
        return TEMPLATE_CHARSET;
    }
    /**
     * Template contents or blank if path.
     * @return inline template
     */
    public String templateString() {
        return TEMPLATE_STRING;
    }
    /**
     * Current escaper.
     * @return escaper
     */
    public  java.util.function.Function templateEscaper() {
        return this.escaper;
    }

    /**
     * Current formatter.
     * @return formatter
     */
    public java.util.function.Function templateFormatter() {
        return this.formatter;
    }

    /**
     * Model class.
     * @return class used as model (annotated with JStache).
     */
    public Class modelClass() {
        return MODEL_CLASS;
    }

    /**
     * Convience static factory that will reuse the same singleton instance.
     * @return renderer same as calling no-arg constructor but is cached with singleton instance
     */
    public static BuilderModelRenderer of() {
        return INSTANCE;
    }

    /**
     * Renders the passed in model.
     * @param data model
     * @param unescapedWriter appendable to write to.
     * @param formatter formats variables before they are passed to the escaper.
     * @param escaper used to write escaped variables.
     * @throws java.io.IOException if an error occurs while writing to the appendable
     */
    public static  void render(
        io.jstach.rainbowgum.apt.BuilderModel data, 
        java.lang.Appendable unescapedWriter,
        java.util.function.Function formatter,
        java.util.function.Function escaper) throws java.io.IOException {

        unescapedWriter.append(
            "package ");

        // variable: packageName
        /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */
        /* TypeMirror: java.lang.String */
        unescapedWriter.append(escaper.apply(formatter.apply(data.packageName())));

        unescapedWriter.append(
            ";\n" +
            "\n" +
            "import io.jstach.rainbowgum.LogProperties;\n" +
            "import io.jstach.rainbowgum.LogProperty;\n" +
            "import io.jstach.rainbowgum.LogProperty.Property;\n" +
            "\n" +
            "/**\n" +
            " * Builder to create {@link ");

        // variable: targetType
        /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */
        /* TypeMirror: java.lang.String */
        unescapedWriter.append(escaper.apply(formatter.apply(data.targetType())));

        unescapedWriter.append(
            " }.\n");

        // start SECTION. name: descriptionLines, template: io/jstach/rainbowgum/apt/ConfigBuilder.java
        /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */
        /* TypeMirror: java.lang.String */
        if (data.descriptionLines() != null) { @SuppressWarnings("unused")
        int i = 0;
        for (java.util.Iterator elementIt = data.descriptionLines().iterator(); elementIt.hasNext(); i++) {
            java.lang.String element = elementIt.next();

            unescapedWriter.append(
                " * ");

            // variable: .
            /* RenderingContext: class io.jstach.apt.internal.context.OwnedRenderingContext */
            /* TypeMirror: java.lang.String */
            unescapedWriter.append(escaper.apply(formatter.apply(element)));

            unescapedWriter.append(
                "\n");
         } }
        // end SECTION. name: descriptionLines, template: io/jstach/rainbowgum/apt/ConfigBuilder.java

        unescapedWriter.append(
            " * \n" +
            " * \n" +
            " * \n" +
            " * \n" +
            " * \n" +
            " * \n" +
            " * \n" +
            " * \n" +
            " * \n");

        // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java
        /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */
        /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */
        if (data.properties() != null) { @SuppressWarnings("unused")
        int i = 0;
        for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) {
            io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next();

            // start SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java
            /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */
            /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */
            if (element.isNormal()) { 

                unescapedWriter.append(
                    " * \n" +
                    " * \n" +
                    " * \n" +
                    " * \n" +
                    " * \n" +
                    " * \n" +
                    " * \n");
             }
            // end SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java
         } }
        // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java

        unescapedWriter.append(
            " * 
Properties retrieved from LogProperties
Property PatternTypeRequiredDefaultDescription
{@value "); // variable: propertyLiteral /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyLiteral()))); unescapedWriter.append( " }"); // variable: typeDescription /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.typeDescription()))); unescapedWriter.append( ""); // variable: required /* RenderingContext: class io.jstach.apt.internal.context.PrimitiveRenderingContext */ /* TypeMirror: boolean */ unescapedWriter.append(escaper.apply(formatter.apply(element.required()))); unescapedWriter.append( ""); // variable: defaultValueDoc /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.defaultValueDoc()))); unescapedWriter.append( ""); // variable: javadoc /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.javadoc()))); unescapedWriter.append( "
\n" + " */\n" + "public final class "); // variable: builderName /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.builderName()))); unescapedWriter.append( " implements io.jstach.rainbowgum.LogBuilder<"); // variable: builderName /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.builderName()))); unescapedWriter.append( ","); // variable: targetType /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.targetType()))); unescapedWriter.append( "> {\n" + "\n" + " /**\n" + " * The properties to be retrieved from config will have\n" + " * this prefix.\n" + " */\n" + " static final String PROPERTY_PREFIX = \""); // variable: propertyPrefix /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.propertyPrefix()))); unescapedWriter.append( "\";\n" + " \n"); // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.properties() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); // start SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isNormal()) { unescapedWriter.append( " /**\n" + " * {@value #"); // variable: propertyLiteral /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyLiteral()))); unescapedWriter.append( " } = "); // variable: type /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.type()))); unescapedWriter.append( " "); // variable: javadoc /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.javadoc()))); unescapedWriter.append( "\n" + " */\n" + " static final String "); // variable: propertyLiteral /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyLiteral()))); unescapedWriter.append( " = PROPERTY_PREFIX + \""); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( "\";\n"); } // end SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java } } // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " \n" + " private final String propertyPrefix;\n"); // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.properties() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); // start SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isNormal()) { unescapedWriter.append( " final Property<"); // variable: typeWithNoAnnotation /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.typeWithNoAnnotation()))); unescapedWriter.append( "> "); // variable: propertyVar /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyVar()))); unescapedWriter.append( ";\n"); } // end SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java } } // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " \n"); // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.properties() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); // start SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isNormal()) { unescapedWriter.append( " private "); // variable: fieldType /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.fieldType()))); unescapedWriter.append( " "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " = "); // variable: defaultValue /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.defaultValue()))); unescapedWriter.append( ";\n"); } // end SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java // start SECTION. name: prefixParameter, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isPrefixParameter()) { unescapedWriter.append( " private final "); // variable: typeWithAnnotation /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.typeWithAnnotation()))); unescapedWriter.append( " "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ";\n"); } // end SECTION. name: prefixParameter, template: io/jstach/rainbowgum/apt/ConfigBuilder.java // start SECTION. name: passThrough, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isPassThrough()) { unescapedWriter.append( " private "); // variable: typeWithAnnotation /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.typeWithAnnotation()))); unescapedWriter.append( " "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ";\n"); } // end SECTION. name: passThrough, template: io/jstach/rainbowgum/apt/ConfigBuilder.java } } // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " \n" + " /**\n" + " * Create a builder for {@code "); // variable: targetType /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.targetType()))); unescapedWriter.append( " }.\n"); // start SECTION. name: prefixParameters, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.prefixParameters() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.prefixParameters().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); unescapedWriter.append( " * @param "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " will fill "); // variable: LB /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.LB()))); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); // variable: RB /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.RB()))); unescapedWriter.append( " in "); // variable: propertyPrefix /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.propertyPrefix()))); unescapedWriter.append( ". "); // variable: javadoc /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.javadoc()))); unescapedWriter.append( "\n"); } } // end SECTION. name: prefixParameters, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " */\n" + " public "); // variable: builderName /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.builderName()))); unescapedWriter.append( "(\n"); // start SECTION. name: prefixParameters, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.prefixParameters() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.prefixParameters().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); unescapedWriter.append( " "); // start INVERTED. name: -first, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.InvertedRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (!((i == 0 ))) { unescapedWriter.append( ", "); } // end INVERTED. name: -first, template: io/jstach/rainbowgum/apt/ConfigBuilder.java // variable: type /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.type()))); unescapedWriter.append( " "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( "\n"); } } // end SECTION. name: prefixParameters, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " ) {\n" + " java.util.Map prefixParameters = java.util.Map.of(\n"); // start SECTION. name: prefixParameters, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.prefixParameters() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.prefixParameters().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); unescapedWriter.append( " "); // start INVERTED. name: -first, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.InvertedRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (!((i == 0 ))) { unescapedWriter.append( ", "); } // end INVERTED. name: -first, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( "\""); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( "\", "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( "\n"); } } // end SECTION. name: prefixParameters, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " );\n" + " this.propertyPrefix = LogProperties.interpolateKey(PROPERTY_PREFIX, prefixParameters);\n"); // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.properties() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); // start SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isNormal()) { unescapedWriter.append( " "); // variable: propertyVar /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyVar()))); unescapedWriter.append( " = Property.builder()\n" + " "); // start SECTION. name: convertMethod, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: [email protected] String */ if (element.convertMethod() != null) { // variable: . /* RenderingContext: class io.jstach.apt.internal.context.OwnedRenderingContext */ /* TypeMirror: [email protected] String */ unescapedWriter.append(escaper.apply(formatter.apply(element.convertMethod()))); unescapedWriter.append( "\n"); } // end SECTION. name: convertMethod, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " .build(LogProperties.interpolateKey("); // variable: propertyLiteral /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyLiteral()))); unescapedWriter.append( ", prefixParameters));\n" + "\n"); } // end SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java // start SECTION. name: prefixParameter, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isPrefixParameter()) { unescapedWriter.append( " this."); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " = "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ";\n"); } // end SECTION. name: prefixParameter, template: io/jstach/rainbowgum/apt/ConfigBuilder.java } } // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " }\n" + "\n"); // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.properties() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); // start SECTION. name: passThrough, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isPassThrough()) { unescapedWriter.append( "\n" + " /**\n" + " * Sets "); // start SECTION. name: required, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.required()) { unescapedWriter.append( "required "); } // end SECTION. name: required, template: io/jstach/rainbowgum/apt/ConfigBuilder.java // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ".\n" + " * "); // variable: javadoc /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.javadoc()))); unescapedWriter.append( "\n" + " * Default is "); // variable: defaultValueDoc /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.defaultValueDoc()))); unescapedWriter.append( ".\n" + " * @param "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " not configurable through properties "); // variable: javadoc /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.javadoc()))); unescapedWriter.append( "\n" + " * @return this builder.\n" + " */\n" + " public "); // variable: builderName /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.builderName()))); unescapedWriter.append( " "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( "("); // variable: typeWithAnnotation /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.typeWithAnnotation()))); unescapedWriter.append( " "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ") {\n" + " this."); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " = "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ";\n" + " return this;\n" + " }\n"); } // end SECTION. name: passThrough, template: io/jstach/rainbowgum/apt/ConfigBuilder.java } } // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( "\n"); // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.properties() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); // start SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isNormal()) { unescapedWriter.append( " \n" + " /**\n" + " * Sets "); // start SECTION. name: required, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.required()) { unescapedWriter.append( "required "); } // end SECTION. name: required, template: io/jstach/rainbowgum/apt/ConfigBuilder.java // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ".\n" + " * "); // variable: javadoc /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.javadoc()))); unescapedWriter.append( "\n" + " * Default is "); // variable: defaultValueDoc /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.defaultValueDoc()))); unescapedWriter.append( ".\n" + " * @param "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " {@value #"); // variable: propertyLiteral /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyLiteral()))); unescapedWriter.append( " } = "); // variable: type /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.type()))); unescapedWriter.append( " "); // variable: javadoc /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.javadoc()))); unescapedWriter.append( "\n" + " * @return this builder.\n" + " */\n" + " public "); // variable: builderName /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.builderName()))); unescapedWriter.append( " "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( "("); // variable: typeWithAnnotation /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.typeWithAnnotation()))); unescapedWriter.append( " "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ") {\n" + " this."); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " = "); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ";\n" + " return this;\n" + " }\n"); } // end SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java } } // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " \n" + " /**\n" + " * Creates {@code "); // variable: targetType /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.targetType()))); unescapedWriter.append( " } from this builder.\n" + " * @return {@code "); // variable: targetType /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.targetType()))); unescapedWriter.append( " }.\n"); // start SECTION. name: exceptions, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ if (data.exceptions() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.exceptions().iterator(); elementIt.hasNext(); i++) { java.lang.String element = elementIt.next(); unescapedWriter.append( " * @throws "); // variable: . /* RenderingContext: class io.jstach.apt.internal.context.OwnedRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element))); unescapedWriter.append( " if factory method fails.\n"); } } // end SECTION. name: exceptions, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " */\n" + " public "); // variable: targetType /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.targetType()))); unescapedWriter.append( " build() "); // variable: throwsList /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.throwsList()))); unescapedWriter.append( "{\n" + " return "); // variable: factoryMethod /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.factoryMethod()))); unescapedWriter.append( "(\n"); // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.properties() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); unescapedWriter.append( " "); // start INVERTED. name: -first, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.InvertedRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (!((i == 0 ))) { unescapedWriter.append( ", "); } // end INVERTED. name: -first, template: io/jstach/rainbowgum/apt/ConfigBuilder.java // start LAMBDA. name: validate, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.LambdaRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ /* DeclaredTypeRenderingContext [ expression=JavaExpression [text=validate, type=java.lang.String, path=[]], definitionElement=java.lang.String, parent=BooleanRenderingContext [expression=validate != null]]*/ var validate = data.validate(element); // start SECTION. name: checkForNull, template: validate /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: java.lang.String */ if (element.checkForNull()) { // variable: propertyVar /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyVar()))); unescapedWriter.append( ".require("); // start PARTIAL. name: @section, template: validate unescapedWriter.append( "this."); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); // end PARTIAL. name: @section, template: validate unescapedWriter.append( ")"); } // end SECTION. name: checkForNull, template: validate // start INVERTED. name: checkForNull, template: validate /* RenderingContext: class io.jstach.apt.internal.context.InvertedRenderingContext */ /* TypeMirror: java.lang.String */ if (!(element.checkForNull())) { // start PARTIAL. name: @section, template: validate unescapedWriter.append( "this."); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); // end PARTIAL. name: @section, template: validate } // end INVERTED. name: checkForNull, template: validate // end LAMBDA. name: validate, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( "\n"); } } // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " );\n" + " }\n" + " \n" + " @Override\n" + " public "); // variable: builderName /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(data.builderName()))); unescapedWriter.append( " fromProperties(LogProperties properties) {\n" + " var __v = LogProperty.Validator.of(this.getClass());\n"); // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.properties() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); // start SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isNormal()) { unescapedWriter.append( " var _"); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " = "); // variable: propertyVar /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyVar()))); unescapedWriter.append( ".get(properties).or(this."); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ");\n" + " __v."); // variable: validateMethod /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.validateMethod()))); unescapedWriter.append( "(_"); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ");\n"); } // end SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java } } // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " __v.validate();\n"); // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.properties() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); // start SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isNormal()) { unescapedWriter.append( " this."); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " = _"); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( "."); // variable: valueMethod /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.valueMethod()))); unescapedWriter.append( "();\n"); } // end SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java } } // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " return this;\n" + " }\n" + " \n" + " /**\n" + " * Turns the builder into java.util.Properties like Map skipping values that are null.\n" + " * @param consumer apply is called where first arg is key and second is value.\n" + " */\n" + " public void toProperties(java.util.function.BiConsumer consumer) {\n"); // start SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (data.properties() != null) { @SuppressWarnings("unused") int i = 0; for (java.util.Iterator elementIt = data.properties().iterator(); elementIt.hasNext(); i++) { io.jstach.rainbowgum.apt.BuilderModel.PropertyModel element = elementIt.next(); // start SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java /* RenderingContext: class io.jstach.apt.internal.context.BooleanRenderingContext */ /* TypeMirror: io.jstach.rainbowgum.apt.BuilderModel.PropertyModel */ if (element.isNormal()) { unescapedWriter.append( " var _"); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " = this."); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( ";\n" + " if (_"); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( " != null) {\n" + " consumer.accept("); // variable: propertyVar /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyVar()))); unescapedWriter.append( ".key(), "); // variable: propertyVar /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.propertyVar()))); unescapedWriter.append( ".propertyString(_"); // variable: name /* RenderingContext: class io.jstach.apt.internal.context.DeclaredTypeRenderingContext */ /* TypeMirror: java.lang.String */ unescapedWriter.append(escaper.apply(formatter.apply(element.name()))); unescapedWriter.append( "));\n" + " }\n"); } // end SECTION. name: normal, template: io/jstach/rainbowgum/apt/ConfigBuilder.java } } // end SECTION. name: properties, template: io/jstach/rainbowgum/apt/ConfigBuilder.java unescapedWriter.append( " }\n" + " \n" + " /**\n" + " * The interpolated property prefix: {@value #PROPERTY_PREFIX}.\n" + " * @return resolved prefix which should end with a \".\".\n" + " */\n" + " @Override\n" + " public String propertyPrefix() {\n" + " return this.propertyPrefix;\n" + " }\n" + " \n" + "}"); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy