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

io.micronaut.starter.cli.feature.database.groovyRepository Maven / Gradle / Ivy

There is a newer version: 4.7.0
Show newest version
package io.micronaut.starter.cli.feature.database;

import java.io.IOException;
import com.fizzed.rocker.ForIterator;
import com.fizzed.rocker.RenderingException;
import com.fizzed.rocker.RockerContent;
import com.fizzed.rocker.RockerOutput;
import com.fizzed.rocker.runtime.DefaultRockerTemplate;
import com.fizzed.rocker.runtime.PlainTextUnloadedClassLoader;
// import @ [1:1]
import io.micronaut.starter.application.Project;

/*
 * Auto generated code to render template io/micronaut/starter/cli/feature/database/groovyRepository.rocker.raw
 * Do not edit this file. Changes will eventually be overwritten by Rocker parser!
 */
@SuppressWarnings("unused")
public class groovyRepository extends com.fizzed.rocker.runtime.DefaultRockerModel {

    static public com.fizzed.rocker.ContentType getContentType() { return com.fizzed.rocker.ContentType.RAW; }
    static public String getTemplateName() { return "groovyRepository.rocker.raw"; }
    static public String getTemplatePackageName() { return "io.micronaut.starter.cli.feature.database"; }
    static public String getHeaderHash() { return "-588538293"; }
    static public String[] getArgumentNames() { return new String[] { "project", "idTypeImport", "idType", "jdbcRepository", "dialect" }; }

    // argument @ [3:2]
    private Project project;
    // argument @ [3:2]
    private String idTypeImport;
    // argument @ [3:2]
    private String idType;
    // argument @ [3:2]
    private Boolean jdbcRepository;
    // argument @ [3:2]
    private String dialect;

    public groovyRepository project(Project project) {
        this.project = project;
        return this;
    }

    public Project project() {
        return this.project;
    }

    public groovyRepository idTypeImport(String idTypeImport) {
        this.idTypeImport = idTypeImport;
        return this;
    }

    public String idTypeImport() {
        return this.idTypeImport;
    }

    public groovyRepository idType(String idType) {
        this.idType = idType;
        return this;
    }

    public String idType() {
        return this.idType;
    }

    public groovyRepository jdbcRepository(Boolean jdbcRepository) {
        this.jdbcRepository = jdbcRepository;
        return this;
    }

    public Boolean jdbcRepository() {
        return this.jdbcRepository;
    }

    public groovyRepository dialect(String dialect) {
        this.dialect = dialect;
        return this;
    }

    public String dialect() {
        return this.dialect;
    }

    static public groovyRepository template(Project project, String idTypeImport, String idType, Boolean jdbcRepository, String dialect) {
        return new groovyRepository()
            .project(project)
            .idTypeImport(idTypeImport)
            .idType(idType)
            .jdbcRepository(jdbcRepository)
            .dialect(dialect);
    }

    @Override
    protected DefaultRockerTemplate buildTemplate() throws RenderingException {
        // optimized for performance (via rocker.optimize flag; no auto reloading)
        return new Template(this);
    }

    static public class Template extends com.fizzed.rocker.runtime.DefaultRockerTemplate {

        // package 
        static private final String PLAIN_TEXT_0_0 = "package ";
        // \n
        static private final String PLAIN_TEXT_1_0 = "\n";
        // \nimport io.micronaut.data.annotation.*\nimport io.micronaut.data.model.*\nimport io.micronaut.data.repository.CrudRepository\n
        static private final String PLAIN_TEXT_2_0 = "\nimport io.micronaut.data.annotation.*\nimport io.micronaut.data.model.*\nimport io.micronaut.data.repository.CrudRepository\n";
        // 
        static private final String PLAIN_TEXT_3_0 = "";
        // import io.micronaut.data.jdbc.annotation.JdbcRepository\nimport io.micronaut.data.model.query.builder.sql.Dialect\n
        static private final String PLAIN_TEXT_4_0 = "import io.micronaut.data.jdbc.annotation.JdbcRepository\nimport io.micronaut.data.model.query.builder.sql.Dialect\n";
        // @JdbcRepository(dialect = Dialect.
        static private final String PLAIN_TEXT_5_0 = "@JdbcRepository(dialect = Dialect.";
        // )\n
        static private final String PLAIN_TEXT_6_0 = ")\n";
        // @JdbcRepository\n
        static private final String PLAIN_TEXT_7_0 = "@JdbcRepository\n";
        // @Repository\n
        static private final String PLAIN_TEXT_8_0 = "@Repository\n";
        // interface 
        static private final String PLAIN_TEXT_9_0 = "interface ";
        // Repository extends CrudRepository<
        static private final String PLAIN_TEXT_10_0 = "Repository extends CrudRepository<";
        // , 
        static private final String PLAIN_TEXT_11_0 = ", ";
        // > {\n\n}\n
        static private final String PLAIN_TEXT_12_0 = "> {\n\n}\n";

        // argument @ [3:2]
        protected final Project project;
        // argument @ [3:2]
        protected final String idTypeImport;
        // argument @ [3:2]
        protected final String idType;
        // argument @ [3:2]
        protected final Boolean jdbcRepository;
        // argument @ [3:2]
        protected final String dialect;

        public Template(groovyRepository model) {
            super(model);
            __internal.setCharset("UTF-8");
            __internal.setContentType(getContentType());
            __internal.setTemplateName(getTemplateName());
            __internal.setTemplatePackageName(getTemplatePackageName());
            this.project = model.project();
            this.idTypeImport = model.idTypeImport();
            this.idType = model.idType();
            this.jdbcRepository = model.jdbcRepository();
            this.dialect = model.dialect();
        }

        @Override
        protected void __doRender() throws IOException, RenderingException {
            // IfBlockBegin @ [11:1]
            __internal.aboutToExecutePosInTemplate(11, 1);
            if (project.getPackageName() != null) {
                // PlainText @ [11:41]
                __internal.aboutToExecutePosInTemplate(11, 41);
                __internal.writeValue(PLAIN_TEXT_0_0);
                // ValueExpression @ [12:9]
                __internal.aboutToExecutePosInTemplate(12, 9);
                __internal.renderValue(project.getPackageName(), false);
                // PlainText @ [12:34]
                __internal.aboutToExecutePosInTemplate(12, 34);
                __internal.writeValue(PLAIN_TEXT_1_0);
                // IfBlockEnd @ [11:1]
                __internal.aboutToExecutePosInTemplate(11, 1);
            } // if end @ [11:1]
            // PlainText @ [13:2]
            __internal.aboutToExecutePosInTemplate(13, 2);
            __internal.writeValue(PLAIN_TEXT_2_0);
            // IfBlockBegin @ [19:1]
            __internal.aboutToExecutePosInTemplate(19, 1);
            if (idTypeImport != null) {
                // ValueExpression @ [20:1]
                __internal.aboutToExecutePosInTemplate(20, 1);
                __internal.renderValue(idTypeImport, false);
                // PlainText @ [20:14]
                __internal.aboutToExecutePosInTemplate(20, 14);
                __internal.writeValue(PLAIN_TEXT_3_0);
                // IfBlockEnd @ [19:1]
                __internal.aboutToExecutePosInTemplate(19, 1);
            } // if end @ [19:1]
            // IfBlockBegin @ [22:1]
            __internal.aboutToExecutePosInTemplate(22, 1);
            if (jdbcRepository) {
                // PlainText @ [22:23]
                __internal.aboutToExecutePosInTemplate(22, 23);
                __internal.writeValue(PLAIN_TEXT_4_0);
                // IfBlockEnd @ [22:1]
                __internal.aboutToExecutePosInTemplate(22, 1);
            } // if end @ [22:1]
            // PlainText @ [25:2]
            __internal.aboutToExecutePosInTemplate(25, 2);
            __internal.writeValue(PLAIN_TEXT_1_0);
            // IfBlockBegin @ [28:1]
            __internal.aboutToExecutePosInTemplate(28, 1);
            if (jdbcRepository) {
                // IfBlockBegin @ [29:1]
                __internal.aboutToExecutePosInTemplate(29, 1);
                if (dialect != null) {
                    // PlainText @ [29:24]
                    __internal.aboutToExecutePosInTemplate(29, 24);
                    __internal.writeValue(PLAIN_TEXT_5_0);
                    // ValueExpression @ [30:36]
                    __internal.aboutToExecutePosInTemplate(30, 36);
                    __internal.renderValue(dialect, false);
                    // PlainText @ [30:44]
                    __internal.aboutToExecutePosInTemplate(30, 44);
                    __internal.writeValue(PLAIN_TEXT_6_0);
                    // IfBlockElse @ [31:1]
                    __internal.aboutToExecutePosInTemplate(31, 1);
                } else { // else @ [31:1]
                    // PlainText @ [31:9]
                    __internal.aboutToExecutePosInTemplate(31, 9);
                    __internal.writeValue(PLAIN_TEXT_7_0);
                    // IfBlockEnd @ [29:1]
                    __internal.aboutToExecutePosInTemplate(29, 1);
                } // if end @ [29:1]
                // IfBlockElse @ [34:1]
                __internal.aboutToExecutePosInTemplate(34, 1);
            } else { // else @ [34:1]
                // PlainText @ [34:9]
                __internal.aboutToExecutePosInTemplate(34, 9);
                __internal.writeValue(PLAIN_TEXT_8_0);
                // IfBlockEnd @ [28:1]
                __internal.aboutToExecutePosInTemplate(28, 1);
            } // if end @ [28:1]
            // PlainText @ [36:2]
            __internal.aboutToExecutePosInTemplate(36, 2);
            __internal.writeValue(PLAIN_TEXT_9_0);
            // ValueExpression @ [37:11]
            __internal.aboutToExecutePosInTemplate(37, 11);
            __internal.renderValue(project.getClassName(), false);
            // PlainText @ [37:34]
            __internal.aboutToExecutePosInTemplate(37, 34);
            __internal.writeValue(PLAIN_TEXT_10_0);
            // ValueExpression @ [37:68]
            __internal.aboutToExecutePosInTemplate(37, 68);
            __internal.renderValue(project.getClassName(), false);
            // PlainText @ [37:91]
            __internal.aboutToExecutePosInTemplate(37, 91);
            __internal.writeValue(PLAIN_TEXT_11_0);
            // ValueExpression @ [37:93]
            __internal.aboutToExecutePosInTemplate(37, 93);
            __internal.renderValue(idType, false);
            // PlainText @ [37:100]
            __internal.aboutToExecutePosInTemplate(37, 100);
            __internal.writeValue(PLAIN_TEXT_12_0);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy