public class Condition extends java.lang.Object implements TemplateEntry
TemplateEntry
that applies other templates based on conditions.
It goes through a number of template entries and executes the first one that is valid.
Modifier and Type | Field and Description |
---|---|
private java.util.List<TemplateEntry> |
entries |
Constructor and Description |
---|
Condition()
Constructs a new
Condition . |
Condition(java.util.Collection<TemplateEntry> entries)
Constructs a new
Condition with predefined template entries. |
Modifier and Type | Method and Description |
---|---|
void |
appendText(java.lang.StringBuilder result,
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.
|
java.lang.String |
toString() |
private final java.util.List<TemplateEntry> entries
public Condition(java.util.Collection<TemplateEntry> entries)
Condition
with predefined template entries.entries
- template entriespublic Condition()
Condition
.public void appendText(java.lang.StringBuilder result, TemplateEngineDataProvider dataProvider)
TemplateEntry
appendText
in interface TemplateEntry
result
- the StringBuilder
to append the text todataProvider
- the data provider from which information should be compiled to a stringpublic boolean isValid(TemplateEngineDataProvider dataProvider)
TemplateEntry
isValid
in interface TemplateEntry
dataProvider
- the data provider to checkpublic java.lang.String toString()
toString
in class java.lang.Object