T
- The model type@Requires(property="micronaut.views.handlebars.enabled",notEquals="false") @Requires(classes=com.github.jknack.handlebars.Handlebars.class) @Singleton public class HandlebarsViewsRenderer<T> extends java.lang.Object implements ViewsRenderer<T>
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
folder |
protected com.github.jknack.handlebars.Handlebars |
handlebars |
protected HandlebarsViewsRendererConfiguration |
handlebarsViewsRendererConfiguration |
protected io.micronaut.core.io.ResourceLoader |
resourceLoader |
protected ViewsConfiguration |
viewsConfiguration |
Constructor and Description |
---|
HandlebarsViewsRenderer(ViewsConfiguration viewsConfiguration,
io.micronaut.core.io.scan.ClassPathResourceLoader resourceLoader,
HandlebarsViewsRendererConfiguration handlebarsViewsRendererConfiguration,
com.github.jknack.handlebars.Handlebars handlebars) |
Modifier and Type | Method and Description |
---|---|
boolean |
exists(java.lang.String viewName) |
io.micronaut.core.io.Writable |
render(java.lang.String viewName,
T data,
io.micronaut.http.HttpRequest<?> request) |
protected final ViewsConfiguration viewsConfiguration
protected final io.micronaut.core.io.ResourceLoader resourceLoader
protected HandlebarsViewsRendererConfiguration handlebarsViewsRendererConfiguration
protected com.github.jknack.handlebars.Handlebars handlebars
protected java.lang.String folder
@Inject public HandlebarsViewsRenderer(ViewsConfiguration viewsConfiguration, io.micronaut.core.io.scan.ClassPathResourceLoader resourceLoader, HandlebarsViewsRendererConfiguration handlebarsViewsRendererConfiguration, com.github.jknack.handlebars.Handlebars handlebars)
viewsConfiguration
- Views ConfigurationresourceLoader
- Resource LoaderhandlebarsViewsRendererConfiguration
- Handlebars ViewRenderer Configuration.handlebars
- Handlebars Engine@NonNull public io.micronaut.core.io.Writable render(@NonNull java.lang.String viewName, @Nullable T data, @Nullable io.micronaut.http.HttpRequest<?> request)
render
in interface ViewsRenderer<T>
viewName
- view name to be rendereddata
- response body to render it with a viewrequest
- HTTP requestpublic boolean exists(@NonNull java.lang.String viewName)
exists
in interface ViewsRenderer<T>
viewName
- view name to be rendered