java.lang.Object
io.jstach.opt.spring.example.hello.HelloModelView
- All Implemented Interfaces:
Renderer<io.jstach.opt.spring.example.hello.HelloModel>,JStachioFilter.FilterChain,TemplateProvider,Template<io.jstach.opt.spring.example.hello.HelloModel>,TemplateInfo
@Component
public class HelloModelView
extends Object
implements Template<io.jstach.opt.spring.example.hello.HelloModel>, TemplateInfo, TemplateProvider, JStachioFilter.FilterChain
Generated Renderer.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jstach.jstachio.TemplateInfo
TemplateInfo.TemplateSource -
Constructor Summary
ConstructorsConstructorDescriptionRenderer constructor for reflection (use of() instead).HelloModelView(TemplateConfig templateConfig) Renderer constructor using config.Renderer constructor for manual wiring. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(io.jstach.opt.spring.example.hello.HelloModel model, Appendable a) Renders the passed in model.voidexecute(io.jstach.opt.spring.example.hello.HelloModel model, Appendable a, Formatter formatter, Escaper escaper) Renders the passed in model.Class<?>Model class.static HelloModelViewof()Convience static factory that will reuse the same singleton instance.static <A extends Appendable>
voidrender(io.jstach.opt.spring.example.hello.HelloModel data, A unescapedWriter, Formatter formatter, Appender<? super A> escaper, Appender<A> appender) Renders the passed in model.booleansupportsType(Class<?> type) Checks to see if a template supports the model class.Appender.Class<?>The template content type is the class annotated withJStacheContentTypewhich also describes the escaper to be used.The escaper to be used on the template.The base formatter to be used on the template.The logical name of the template which maybe different thanTemplateInfo.templatePath().If the template is a classpath resource file this will return the location that was originally resolved viaconfig resolution.The raw contents of the template.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jstach.jstachio.TemplateInfo
description, lastLoaded, normalizePath, templateSourceMethods inherited from interface io.jstach.jstachio.spi.TemplateProvider
provideTemplates
-
Constructor Details
-
HelloModelView
Renderer constructor for manual wiring.- Parameters:
formatter- formatter if null the static formatter will be used.escaper- escaper if null the static escaper will be used
-
HelloModelView
public HelloModelView()Renderer constructor for reflection (use of() instead). For programmatic consider usingof()for a shared singleton. -
HelloModelView
Renderer constructor using config.- Parameters:
templateConfig- config that has collaborators
-
-
Method Details
-
execute
public void execute(io.jstach.opt.spring.example.hello.HelloModel model, Appendable a) throws IOException Description copied from interface:TemplateRenders the passed in model.- Specified by:
executein interfaceRenderer<io.jstach.opt.spring.example.hello.HelloModel>- Specified by:
executein interfaceTemplate<io.jstach.opt.spring.example.hello.HelloModel>- Parameters:
model- a model assumed never to benull.a- the appendable to write to.- Throws:
IOException- if there is an error writing to the appendable
-
execute
public void execute(io.jstach.opt.spring.example.hello.HelloModel model, Appendable a, Formatter formatter, Escaper escaper) throws IOException Description copied from interface:TemplateRenders the passed in model.- Specified by:
executein interfaceTemplate<io.jstach.opt.spring.example.hello.HelloModel>- Parameters:
model- a model assumed never to benull.a- appendable to write to.formatter- formats variables before they are passed to the escaperescaper- used to write escaped variables- Throws:
IOException- if an error occurs while writing to the appendable
-
supportsType
Description copied from interface:TemplateInfoChecks to see if a template supports the model class.- Specified by:
supportsTypein interfaceTemplateInfo- Parameters:
type- the class of the model.- Returns:
- if this renderer supports the class.
-
templatePath
Description copied from interface:TemplateInfoIf the template is a classpath resource file this will return the location that was originally resolved viaconfig resolution.- Specified by:
templatePathin interfaceTemplateInfo- Returns:
- the location of the template or empty if the template is inlined.
- See Also:
-
templateName
Description copied from interface:TemplateInfoThe logical name of the template which maybe different thanTemplateInfo.templatePath().- Specified by:
templateNamein interfaceTemplateInfo- Returns:
- logical name of template. Never null.
-
templateString
Description copied from interface:TemplateInfoThe raw contents of the template. Useful if the template is inline. To determine if the template is actually inline useTemplateInfo.templateSource().- Specified by:
templateStringin interfaceTemplateInfo- Returns:
- the raw contents of the template never null.
- See Also:
-
templateContentType
Description copied from interface:TemplateInfoThe template content type is the class annotated withJStacheContentTypewhich also describes the escaper to be used.- Specified by:
templateContentTypein interfaceTemplateInfo- Returns:
- the template content type.
-
templateEscaper
Description copied from interface:TemplateInfoThe escaper to be used on the template. SeeEscaper.of(Function).- Specified by:
templateEscaperin interfaceTemplateInfo- Returns:
- the escaper.
- See Also:
-
templateFormatter
Description copied from interface:TemplateInfoThe base formatter to be used on the template. SeeFormatter.of(Function).- Specified by:
templateFormatterin interfaceTemplateInfo- Returns:
- the formatter.
- See Also:
-
templateAppender
Appender.- Returns:
- appender for writing unescaped variables.
-
modelClass
Model class.- Specified by:
modelClassin interfaceTemplate<io.jstach.opt.spring.example.hello.HelloModel>- Returns:
- class used as model (annotated with JStache).
-
of
Convience static factory that will reuse the same singleton instance.- Returns:
- renderer same as calling no-arg constructor but is cached with singleton instance
-
render
public static <A extends Appendable> void render(io.jstach.opt.spring.example.hello.HelloModel data, A unescapedWriter, Formatter formatter, Appender<? super A> escaper, Appender<A> appender) throws IOException Renders the passed in model.- Type Parameters:
A- appendable type.- Parameters:
data- modelunescapedWriter- appendable to write to.formatter- formats variables before they are passed to the escaper.escaper- used to write escaped variables.appender- used to write unescaped variables.- Throws:
IOException- if an error occurs while writing to the appendable
-