Class MapVariableInterpolator
- java.lang.Object
-
- org.apache.wicket.util.string.interpolator.VariableInterpolator
-
- org.apache.wicket.util.string.interpolator.MapVariableInterpolator
-
- All Implemented Interfaces:
Serializable
,IClusterable
- Direct Known Subclasses:
SystemVariableInterpolator
public class MapVariableInterpolator extends VariableInterpolator
Interpolates variables into aString
from aMap
.- Since:
- 1.2.6
- Author:
- Jonathan Locke
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.wicket.util.string.interpolator.VariableInterpolator
string
-
-
Constructor Summary
Constructors Constructor Description MapVariableInterpolator(String string, Map<?,?> variables)
Constructor.MapVariableInterpolator(String string, Map<?,?> variables, boolean exceptionOnNullVarValue)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getValue(String variableName)
Retrieves a value for a variable name during interpolation.static String
interpolate(String string, Map<?,?> variables)
Interpolates aString
with the arguments defined in the givenMap
.void
setVariables(Map<?,?> variables)
Sets theMap
of variables.-
Methods inherited from class org.apache.wicket.util.string.interpolator.VariableInterpolator
toString
-
-
-
-
Constructor Detail
-
MapVariableInterpolator
public MapVariableInterpolator(String string, Map<?,?> variables)
Constructor.- Parameters:
string
- aString
to interpolate intovariables
- the variables to substitute
-
MapVariableInterpolator
public MapVariableInterpolator(String string, Map<?,?> variables, boolean exceptionOnNullVarValue)
Constructor.- Parameters:
string
- aString
to interpolate intovariables
- the variables to substituteexceptionOnNullVarValue
- iftrue
anIllegalStateException
will be thrown ifgetValue(String)
returnsnull
, otherwise the${varname}
string will be left in theString
so that multiple interpolators can be chained
-
-
Method Detail
-
setVariables
public final void setVariables(Map<?,?> variables)
Sets theMap
of variables.- Parameters:
variables
- theMap
of variables
-
getValue
protected String getValue(String variableName)
Retrieves a value for a variable name during interpolation.- Specified by:
getValue
in classVariableInterpolator
- Parameters:
variableName
- the variable name- Returns:
- the value
-
interpolate
public static String interpolate(String string, Map<?,?> variables)
Interpolates aString
with the arguments defined in the givenMap
.- Parameters:
string
- aString
to interpolate intovariables
- the variables to substitute- Returns:
- the interpolated
String
-
-