Class MapVariableInterpolator
- java.lang.Object
-
- org.apache.wicket.util.string.interpolator.VariableInterpolator
-
- org.apache.wicket.util.string.interpolator.MapVariableInterpolator
-
- All Implemented Interfaces:
java.io.Serializable,IClusterable
- Direct Known Subclasses:
SystemVariableInterpolator
public class MapVariableInterpolator extends VariableInterpolator
Interpolates variables into aStringfrom 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(java.lang.String string, java.util.Map<?,?> variables)Constructor.MapVariableInterpolator(java.lang.String string, java.util.Map<?,?> variables, boolean exceptionOnNullVarValue)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringgetValue(java.lang.String variableName)Retrieves a value for a variable name during interpolation.static java.lang.Stringinterpolate(java.lang.String string, java.util.Map<?,?> variables)Interpolates aStringwith the arguments defined in the givenMap.voidsetVariables(java.util.Map<?,?> variables)Sets theMapof variables.-
Methods inherited from class org.apache.wicket.util.string.interpolator.VariableInterpolator
toString
-
-
-
-
Constructor Detail
-
MapVariableInterpolator
public MapVariableInterpolator(java.lang.String string, java.util.Map<?,?> variables)Constructor.- Parameters:
string- aStringto interpolate intovariables- the variables to substitute
-
MapVariableInterpolator
public MapVariableInterpolator(java.lang.String string, java.util.Map<?,?> variables, boolean exceptionOnNullVarValue)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 Detail
-
setVariables
public final void setVariables(java.util.Map<?,?> variables)
Sets theMapof variables.- Parameters:
variables- theMapof variables
-
getValue
protected java.lang.String getValue(java.lang.String variableName)
Retrieves a value for a variable name during interpolation.- Specified by:
getValuein classVariableInterpolator- Parameters:
variableName- the variable name- Returns:
- the value
-
interpolate
public static java.lang.String interpolate(java.lang.String string, java.util.Map<?,?> variables)Interpolates aStringwith the arguments defined in the givenMap.- Parameters:
string- aStringto interpolate intovariables- the variables to substitute- Returns:
- the interpolated
String
-
-