Interface TemplateEntry
-
- All Known Implementing Classes:
CompoundTemplateEntry
,Condition
,ContextSwitchTemplate
,SearchExpressionCondition
,StaticText
,Variable
public interface TemplateEntry
Interface for one node in the abstract syntax tree that is the result of parsing a template string withTemplateParser
. The node can either be branching (condition, context switch) or a leaf node (variable, static text). The root node, representing the entire template is also aTemplateEntry
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
appendText(java.lang.StringBuilder result, TemplateEngineDataProvider dataProvider)
Execute this template by generating text for a given data provider.default java.lang.String
getText(TemplateEngineDataProvider dataProvider)
Execute this template by generating text for a given data provider.boolean
isValid(TemplateEngineDataProvider dataProvider)
Check if this template is applicable to the given data provider.
-
-
-
Method Detail
-
getText
default java.lang.String getText(TemplateEngineDataProvider dataProvider)
Execute this template by generating text for a given data provider.- Parameters:
dataProvider
- the data provider from which information should be compiled to a string- Returns:
- the generated text
-
appendText
void appendText(java.lang.StringBuilder result, TemplateEngineDataProvider dataProvider)
Execute this template by generating text for a given data provider.- Parameters:
result
- theStringBuilder
to append the text todataProvider
- the data provider from which information should be compiled to a string
-
isValid
boolean isValid(TemplateEngineDataProvider dataProvider)
Check if this template is applicable to the given data provider.- Parameters:
dataProvider
- the data provider to check- Returns:
- true if all conditions are fulfilled to apply the template (for instance all required key=value mappings are present), false otherwise
-
-