Class ContextSwitchTemplate
java.lang.Object
org.openstreetmap.josm.tools.template_engine.ContextSwitchTemplate
- All Implemented Interfaces:
TemplateEntry
The context switch offers possibility to use tags of referenced primitive when constructing primitive name.
- Since:
- 4546
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate static classprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ContextSwitchTemplate.ContextProviderprivate static final TemplateEngineDataProviderprivate final TemplateEntry -
Constructor Summary
ConstructorsConstructorDescriptionContextSwitchTemplate(SearchCompiler.Match match, TemplateEntry template, int searchExpressionPosition) Constructs a newContextSwitchTemplate. -
Method Summary
Modifier and TypeMethodDescriptionvoidappendText(StringBuilder result, TemplateEngineDataProvider dataProvider) Execute this template by generating text for a given data provider.booleaninthashCode()booleanisValid(TemplateEngineDataProvider dataProvider) Check if this template is applicable to the given data provider.private static SearchCompiler.Matchtransform(SearchCompiler.Match m, int searchExpressionPosition) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.tools.template_engine.TemplateEntry
getText
-
Field Details
-
EMPTY_PROVIDER
-
context
-
template
-
-
Constructor Details
-
ContextSwitchTemplate
public ContextSwitchTemplate(SearchCompiler.Match match, TemplateEntry template, int searchExpressionPosition) throws ParseError Constructs a newContextSwitchTemplate.- Parameters:
match- matchtemplate- templatesearchExpressionPosition- search expression position- Throws:
ParseError- if a parse error occurs, or if the match transformation returns the same primitive
-
-
Method Details
-
transform
private static SearchCompiler.Match transform(SearchCompiler.Match m, int searchExpressionPosition) throws ParseError - Throws:
ParseError
-
appendText
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
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
-
hashCode
-
equals
-