VariableExpanderpublic class MultiVariableExpander extends java.lang.Object implements VariableExpander
Expands variable references from multiple sources.
| Constructor | Description |
|---|---|
MultiVariableExpander() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addSource(java.lang.String marker,
java.util.Map<java.lang.String,java.lang.Object> source) |
|
java.lang.String |
expand(java.lang.String param) |
Return the input string with any variables replaced by their
corresponding value.
|
java.lang.String |
expand(java.lang.String str,
java.lang.String marker,
java.util.Map<java.lang.String,java.lang.Object> source) |
Replace any occurrences within the string of the form
"marker{key}" with the value from source[key].
|
public MultiVariableExpander()
public void addSource(java.lang.String marker, java.util.Map<java.lang.String,java.lang.Object> source)
public java.lang.String expand(java.lang.String param)
VariableExpanderexpand in interface VariableExpanderpublic java.lang.String expand(java.lang.String str, java.lang.String marker, java.util.Map<java.lang.String,java.lang.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).
java.lang.IllegalArgumentException - if the input param references
a variable which is not known to the specified source.