public class MapVariableInterpolator extends VariableInterpolator
String
from a Map
.string
Constructor and Description |
---|
MapVariableInterpolator(String string,
Map<?,?> variables)
Constructor.
|
MapVariableInterpolator(String string,
Map<?,?> variables,
boolean exceptionOnNullVarValue)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getValue(String variableName)
Retrieves a value for a variable name during interpolation.
|
static String |
interpolate(String string,
Map<?,?> variables)
Interpolates a
String with the arguments defined in the given Map . |
void |
setVariables(Map<?,?> variables)
Sets the
Map of variables. |
toString
public MapVariableInterpolator(String string, Map<?,?> variables)
string
- a String
to interpolate intovariables
- the variables to substitutepublic MapVariableInterpolator(String string, Map<?,?> variables, boolean exceptionOnNullVarValue)
string
- a String
to interpolate intovariables
- the variables to substituteexceptionOnNullVarValue
- if true
an IllegalStateException
will be thrown if
getValue(String)
returns null
, otherwise the
${varname}
string will be left in the String
so that
multiple interpolators can be chainedpublic final void setVariables(Map<?,?> variables)
Map
of variables.variables
- the Map
of variablesprotected String getValue(String variableName)
getValue
in class VariableInterpolator
variableName
- the variable nameCopyright © 2006–2022 Apache Software Foundation. All rights reserved.