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

io.micronaut.starter.feature.view.reactControllerJava Maven / Gradle / Ivy

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

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/feature/view/reactControllerJava.rocker.raw
 * Do not edit this file. Changes will eventually be overwritten by Rocker parser!
 */
@SuppressWarnings("unused")
public class reactControllerJava extends com.fizzed.rocker.runtime.DefaultRockerModel {

    static public com.fizzed.rocker.ContentType getContentType() { return com.fizzed.rocker.ContentType.RAW; }
    static public String getTemplateName() { return "reactControllerJava.rocker.raw"; }
    static public String getTemplatePackageName() { return "io.micronaut.starter.feature.view"; }
    static public String getHeaderHash() { return "-1654727492"; }
    static public String[] getArgumentNames() { return new String[] { "project" }; }

    // argument @ [3:2]
    private Project project;

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

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

    static public reactControllerJava template(Project project) {
        return new reactControllerJava()
            .project(project);
    }

    @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";
        // import io.micronaut.core.annotation.Introspected;\nimport io.micronaut.http.annotation.Controller;\nimport io.micronaut.http.annotation.Get;\nimport io.micronaut.http.HttpResponse;\nimport io.micronaut.serde.annotation.Serdeable;\nimport io.micronaut.views.View;\n\nimport java.time.LocalDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.time.format.FormatStyle;\n\n@Controller\npublic class AppController {\n    @Serdeable.Serializable\n    public record CurrentTime(String now) ...
        static private final String PLAIN_TEXT_2_0 = "import io.micronaut.core.annotation.Introspected;\nimport io.micronaut.http.annotation.Controller;\nimport io.micronaut.http.annotation.Get;\nimport io.micronaut.http.HttpResponse;\nimport io.micronaut.serde.annotation.Serdeable;\nimport io.micronaut.views.View;\n\nimport java.time.LocalDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.time.format.FormatStyle;\n\n@Controller\npublic class AppController {\n    @Serdeable.Serializable\n    public record CurrentTime(String now) {}\n\n    @Introspected\n    public record InitialProps(String name) {\n    }\n\n    @View(\"App\")\n    @Get\n    public HttpResponse index() {\n        return HttpResponse.ok(new InitialProps(\"'your name goes here'\"));\n    }\n\n    @Get(\"/api/time\")\n    public CurrentTime time() {\n        return new CurrentTime(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).format(LocalDateTime.now()));\n    }\n}\n";

        // argument @ [3:2]
        protected final Project project;

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

        @Override
        protected void __doRender() throws IOException, RenderingException {
            // IfBlockBegin @ [7:1]
            __internal.aboutToExecutePosInTemplate(7, 1);
            if (project.getPackageName() != null) {
                // PlainText @ [7:41]
                __internal.aboutToExecutePosInTemplate(7, 41);
                __internal.writeValue(PLAIN_TEXT_0_0);
                // ValueExpression @ [8:9]
                __internal.aboutToExecutePosInTemplate(8, 9);
                __internal.renderValue(project.getPackageName(), false);
                // PlainText @ [8:34]
                __internal.aboutToExecutePosInTemplate(8, 34);
                __internal.writeValue(PLAIN_TEXT_1_0);
                // IfBlockEnd @ [7:1]
                __internal.aboutToExecutePosInTemplate(7, 1);
            } // if end @ [7:1]
            // PlainText @ [9:2]
            __internal.aboutToExecutePosInTemplate(9, 2);
            __internal.writeValue(PLAIN_TEXT_2_0);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy