Class PlaceholderExpression
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.mapcss.PlaceholderExpression
-
- All Implemented Interfaces:
Expression
public final class PlaceholderExpression extends java.lang.Object implements Expression
Used for expressions that contain placeholders- Since:
- 18758
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.Pattern
PATTERN_PLACEHOLDER
The regex used for pattern replacementprivate java.lang.String
placeholder
-
Constructor Summary
Constructors Constructor Description PlaceholderExpression(java.lang.String placeholder)
Constructs a newPlaceholderExpression
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
determineArgument(Selector matchingSelector, int index, java.lang.String type, Tagged p)
java.lang.Object
evaluate(Environment env)
Evaluate this expression.static java.lang.String
insertArguments(Selector matchingSelector, java.lang.String s, Tagged p)
Replaces occurrences of{i.key}
,{i.value}
,{i.tag}
ins
by the corresponding key/value/tag of theindex
-thCondition
ofmatchingSelector
.java.lang.String
toString()
-
-
-
Field Detail
-
PATTERN_PLACEHOLDER
public static final java.util.regex.Pattern PATTERN_PLACEHOLDER
The regex used for pattern replacement
-
placeholder
private final java.lang.String placeholder
-
-
Constructor Detail
-
PlaceholderExpression
public PlaceholderExpression(java.lang.String placeholder)
Constructs a newPlaceholderExpression
.- Parameters:
placeholder
- The placeholder expression
-
-
Method Detail
-
evaluate
public java.lang.Object evaluate(Environment env)
Description copied from interface:Expression
Evaluate this expression.- Specified by:
evaluate
in interfaceExpression
- Parameters:
env
- The environment- Returns:
- the result of the evaluation, can be a
List
, String or any primitive type or wrapper classes of a primitive type.
-
insertArguments
public static java.lang.String insertArguments(Selector matchingSelector, java.lang.String s, Tagged p)
Replaces occurrences of{i.key}
,{i.value}
,{i.tag}
ins
by the corresponding key/value/tag of theindex
-thCondition
ofmatchingSelector
.- Parameters:
matchingSelector
- matching selectors
- any stringp
- OSM primitive- Returns:
- string with arguments inserted
-
determineArgument
private static java.lang.String determineArgument(Selector matchingSelector, int index, java.lang.String type, Tagged p)
- Parameters:
matchingSelector
- matching selectorindex
- indextype
- selector type ("key", "value" or "tag")p
- OSM primitive- Returns:
- argument value, can be
null
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-