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 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(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 StringgetValue(String variableName)Retrieves a value for a variable name during interpolation.static Stringinterpolate(String string, Map<?,?> variables)Interpolates aStringwith the arguments defined in the givenMap.voidsetVariables(Map<?,?> variables)Sets theMapof 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- aStringto interpolate intovariables- the variables to substitute
-
MapVariableInterpolator
public MapVariableInterpolator(String string, 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(Map<?,?> variables)
Sets theMapof variables.- Parameters:
variables- theMapof variables
-
getValue
protected String getValue(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 String interpolate(String string, Map<?,?> variables)
Interpolates aStringwith the arguments defined in the givenMap.- Parameters:
string- aStringto interpolate intovariables- the variables to substitute- Returns:
- the interpolated
String
-
-