Class SearchExpressionCondition
- java.lang.Object
-
- org.openstreetmap.josm.tools.template_engine.SearchExpressionCondition
-
- All Implemented Interfaces:
TemplateEntry
public class SearchExpressionCondition extends java.lang.Object implements TemplateEntry
ConditionalTemplateEntry
that executes another template in case a search expression applies to the given data provider.
-
-
Field Summary
Fields Modifier and Type Field Description private SearchCompiler.Match
condition
private TemplateEntry
text
-
Constructor Summary
Constructors Constructor Description SearchExpressionCondition(SearchCompiler.Match condition, TemplateEntry text)
Creates a newSearchExpressionCondition
.
-
Method Summary
All Methods Instance Methods Concrete 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.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()
-
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
-
condition
private final SearchCompiler.Match condition
-
text
private final TemplateEntry text
-
-
Constructor Detail
-
SearchExpressionCondition
public SearchExpressionCondition(SearchCompiler.Match condition, TemplateEntry text)
Creates a newSearchExpressionCondition
.- Parameters:
condition
- the match condition that is checked before applying the child templatetext
- the child template to execute in case the condition is fulfilled
-
-
Method Detail
-
appendText
public void appendText(java.lang.StringBuilder result, TemplateEngineDataProvider dataProvider)
Description copied from interface:TemplateEntry
Execute this template by generating text for a given data provider.- Specified by:
appendText
in interfaceTemplateEntry
- Parameters:
result
- theStringBuilder
to 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:TemplateEntry
Check if this template is applicable to the given data provider.- Specified by:
isValid
in 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:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-