public class MultiVariableExpander extends Object implements VariableExpander
Expands variable references from multiple sources.
Constructor and Description |
---|
MultiVariableExpander() |
Modifier and Type | Method and Description |
---|---|
void |
addSource(String marker,
Map<String,Object> source) |
String |
expand(String param)
Return the input string with any variables replaced by their
corresponding value.
|
String |
expand(String str,
String marker,
Map<String,Object> source)
Replace any occurrences within the string of the form
"marker{key}" with the value from source[key].
|
public String expand(String param)
VariableExpander
expand
in interface VariableExpander
public String expand(String str, String marker, Map<String,Object> source)
Commonly, the variable marker is "$", in which case variables are indicated by ${key} in the string.
Returns the string after performing all substitutions.
If no substitutions were made, the input string object is returned (not a copy).
IllegalArgumentException
- if the input param references
a variable which is not known to the specified source.Copyright © 2001–2014 The Apache Software Foundation. All rights reserved.