- Type Parameters:
T
- the model type
- All Known Subinterfaces:
JStachio
,Template<T>
,Template.EncodedTemplate<T>
,ViewableTemplate<T>
- All Known Implementing Classes:
AbstractJStachio
,ExampleModelRenderer
,HelloModelAndViewView
,HelloModelView
,HelloModelView
,MessagePageRenderer
,MessagePageRenderer
,SpringJStachio
public interface Renderer<T>
Renders models of type
T
by writing to an Appendable. Implementations
should be generally stateless and threadsafe.-
Method Summary
Modifier and TypeMethodDescriptiondefault String
Convenience method that directly renders the model as a String.Renders the passed in model.default void
execute
(T model, Appendable appendable) Renders the passed in model.default StringBuilder
execute
(T model, StringBuilder sb) A convenience method that does not throwIOException
when using StringBuilder.
-
Method Details
-
execute
Renders the passed in model.- Type Parameters:
A
- output typeE
- error type- Parameters:
model
- a model assumed never to benull
.appendable
- the output to write to.- Returns:
- the output passed in returned for convenience.
- Throws:
E
- if there is an error writing to the output
-
execute
Renders the passed in model.- Parameters:
model
- a model assumed never to benull
.appendable
- the appendable to write to.- Throws:
IOException
- if there is an error writing to the appendable
-
execute
A convenience method that does not throwIOException
when using StringBuilder.- Parameters:
model
- a model assumed never to be null.sb
- should never be null.- Returns:
- the passed in
StringBuilder
.
-
execute
Convenience method that directly renders the model as a String.- Parameters:
model
- never null.- Returns:
- the rendered model.
-