Module org.apache.wicket.util
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
Interpolates variables into a
String
from a Map
.- Since:
- 1.2.6
- Author:
- Jonathan Locke
- See Also:
-
Field Summary
Fields inherited from class org.apache.wicket.util.string.interpolator.VariableInterpolator
string
-
Constructor Summary
ConstructorsConstructorDescriptionMapVariableInterpolator
(String string, Map<?, ?> variables) Constructor.MapVariableInterpolator
(String string, Map<?, ?> variables, boolean exceptionOnNullVarValue) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
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
.final void
setVariables
(Map<?, ?> variables) Sets theMap
of variables.Methods inherited from class org.apache.wicket.util.string.interpolator.VariableInterpolator
toString
-
Constructor Details
-
MapVariableInterpolator
Constructor.- Parameters:
string
- aString
to interpolate intovariables
- the variables to substitute
-
MapVariableInterpolator
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 Details
-
setVariables
Sets theMap
of variables.- Parameters:
variables
- theMap
of variables
-
getValue
Retrieves a value for a variable name during interpolation.- Specified by:
getValue
in classVariableInterpolator
- Parameters:
variableName
- the variable name- Returns:
- the value
-
interpolate
Interpolates aString
with the arguments defined in the givenMap
.- Parameters:
string
- aString
to interpolate intovariables
- the variables to substitute- Returns:
- the interpolated
String
-