- All Known Implementing Classes:
AbstractJStachio
,SpringJStachio
A special JStachio that can render models with a loose typed context object bound to
"@context".
- Since:
- 1.3.0
- Author:
- agentgt
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionexecute
(Object model, ContextNode context, A appendable) Renders the passed in model with a context.static ContextJStachio
Decorates a JStachio instance as aContextJStachio
if it is not already one.<A extends Output.EncodedOutput<E>,
E extends Exception>
Awrite
(Object model, ContextNode context, A output) Renders the passed in model with a context directly to a binary stream leveraging pre-encoded parts of the template.Methods inherited from interface io.jstach.jstachio.JStachio
execute, execute, execute, findTemplate, supportsType, write
-
Method Details
-
execute
<A extends Output<E>,E extends Exception> A execute(Object model, ContextNode context, A appendable) throws E Renders the passed in model with a context.- Type Parameters:
A
- output typeE
- error type- Parameters:
model
- a model assumed never to benull
.context
- context node bound to "@context".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
-
write
<A extends Output.EncodedOutput<E>,E extends Exception> A write(Object model, ContextNode context, A output) throws E Renders the passed in model with a context directly to a binary stream leveraging pre-encoded parts of the template. This may improve performance when rendering UTF-8 to an OutputStream as some of the encoding is done in advance. Because the encoding is done statically you cannot pass the charset in. The chosen charset comes fromJStacheConfig.charset()
.- Type Parameters:
A
- output typeE
- error type- Parameters:
model
- a model assumed never to benull
.context
- context node bound to "@context".output
- to write to.- Returns:
- the passed in output for convenience
- Throws:
E
- if an error occurs while writing to output
-
of
Decorates a JStachio instance as aContextJStachio
if it is not already one.- Parameters:
jstachio
- the instance to be wrapped.- Returns:
- the passed in jstachio if it is already a
ContextJStachio
otherwise wraps the passed in instance.
-