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 |
equals(java.lang.Object obj) |
int |
hashCode() |
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)
TemplateEntryappendText in interface TemplateEntryresult - the StringBuilder to append the text todataProvider - the data provider from which information should be compiled to a stringpublic boolean isValid(TemplateEngineDataProvider dataProvider)
TemplateEntryisValid in interface TemplateEntrydataProvider - the data provider to checkpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object