Class CompoundTemplateEntry
- java.lang.Object
-
- org.openstreetmap.josm.tools.template_engine.CompoundTemplateEntry
-
- All Implemented Interfaces:
TemplateEntry
public final class CompoundTemplateEntry extends java.lang.Object implements TemplateEntry
TemplateEntrythat concatenates several templates.
-
-
Field Summary
Fields Modifier and Type Field Description private TemplateEntry[]entries
-
Constructor Summary
Constructors Modifier Constructor Description privateCompoundTemplateEntry(TemplateEntry... entries)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendText(java.lang.StringBuilder result, TemplateEngineDataProvider dataProvider)Execute this template by generating text for a given data provider.booleanequals(java.lang.Object obj)static TemplateEntryfromArray(TemplateEntry... entries)Factory method to concatenate severalTemplateEntrys.inthashCode()booleanisValid(TemplateEngineDataProvider dataProvider)Check if this template is applicable to the given data provider.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.tools.template_engine.TemplateEntry
getText
-
-
-
-
Field Detail
-
entries
private final TemplateEntry[] entries
-
-
Constructor Detail
-
CompoundTemplateEntry
private CompoundTemplateEntry(TemplateEntry... entries)
-
-
Method Detail
-
fromArray
public static TemplateEntry fromArray(TemplateEntry... entries)
Factory method to concatenate severalTemplateEntrys. If the number of entries is 0 or 1, the result may not be aCompoundTemplateEntry, but optimized to a static text or the single entry itself.- Parameters:
entries- theTemplateEntrys to concatenate- Returns:
- a
TemplateEntrythat concatenates all the entries
-
appendText
public void appendText(java.lang.StringBuilder result, TemplateEngineDataProvider dataProvider)
Description copied from interface:TemplateEntryExecute this template by generating text for a given data provider.- Specified by:
appendTextin interfaceTemplateEntry- Parameters:
result- theStringBuilderto append the text todataProvider- the data provider from which information should be compiled to a string
-
isValid
public boolean isValid(TemplateEngineDataProvider dataProvider)
Description copied from interface:TemplateEntryCheck if this template is applicable to the given data provider.- Specified by:
isValidin interfaceTemplateEntry- 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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-