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 StringRetrieves a value for a variable name during interpolation.static Stringinterpolate(String string, Map<?, ?> variables) Interpolates aStringwith the arguments defined in the givenMap.final voidsetVariables(Map<?, ?> variables) Sets theMapof variables.Methods inherited from class org.apache.wicket.util.string.interpolator.VariableInterpolator
toString
-
Constructor Details
-
MapVariableInterpolator
Constructor.- Parameters:
string- aStringto interpolate intovariables- the variables to substitute
-
MapVariableInterpolator
Constructor.- Parameters:
string- aStringto interpolate intovariables- the variables to substituteexceptionOnNullVarValue- iftrueanIllegalStateExceptionwill be thrown ifgetValue(String)returnsnull, otherwise the${varname}string will be left in theStringso that multiple interpolators can be chained
-
-
Method Details
-
setVariables
Sets theMapof variables.- Parameters:
variables- theMapof variables
-
getValue
Retrieves a value for a variable name during interpolation.- Specified by:
getValuein classVariableInterpolator- Parameters:
variableName- the variable name- Returns:
- the value
-
interpolate
Interpolates aStringwith the arguments defined in the givenMap.- Parameters:
string- aStringto interpolate intovariables- the variables to substitute- Returns:
- the interpolated
String
-