Interface TemplateRenderer
-
- All Implemented Interfaces:
-
com.embabel.common.textio.template.TemplateCompiler
public interface TemplateRenderer implements TemplateCompiler
Object that can render templates with a model. Methods throw unchecked exceptions if the template is not found or is invalid. The exceptions defined in this interface will wrap exceptions from an underlying implementation. "loaded" methods load Spring Resource's, while "literal" methods take a string literal
-
-
Method Summary
Modifier and Type Method Description abstract Stringload(String templateName)Load the template. abstract StringrenderLoadedTemplate(String templateName, Map<String, Object> model)Render a template with the given model abstract StringrenderLiteralTemplate(String template, Map<String, Object> model)Render a template string without loading it CompiledTemplatecompileLoadedTemplate(String templateName)Create a reusable template -
-
Method Detail
-
load
abstract String load(String templateName)
Load the template. Useful if we have to introspect it
- Parameters:
templateName- name of the template- Returns:
template content
-
renderLoadedTemplate
abstract String renderLoadedTemplate(String templateName, Map<String, Object> model)
Render a template with the given model
- Parameters:
templateName- template to use.model- model- Returns:
string result of rendering string
-
renderLiteralTemplate
abstract String renderLiteralTemplate(String template, Map<String, Object> model)
Render a template string without loading it
- Parameters:
template- template as string literalmodel- model to render- Returns:
rendered string
-
compileLoadedTemplate
CompiledTemplate compileLoadedTemplate(String templateName)
Create a reusable template
-
-
-
-