Class PropertyVariableInterpolator
- java.lang.Object
-
- org.apache.wicket.util.string.interpolator.VariableInterpolator
-
- org.apache.wicket.core.util.string.interpolator.PropertyVariableInterpolator
-
- All Implemented Interfaces:
Serializable
,IClusterable
- Direct Known Subclasses:
ConvertingPropertyVariableInterpolator
public class PropertyVariableInterpolator extends VariableInterpolator
Interpolates values intoString
s that are produced by interpreting property expressions against an object.Takes a string such as "
My name is ${name}
" and a bean such as aPerson
, and reflects on the object using any property expressions found inside${}
markers in theString
. In this case, if thePerson
model has agetName()
method. The results of calling that method would be substituted for${name}
. IfgetName()
returned"Jonathan"
, then the result would return"My name is Jonathan"
."$" is the escape char. Thus "$${text}" can be used to escape it (ignore interpretation). If '$3.24' is needed then '$$${amount}' should be used. The first $ sign escapes the second, and the third is used to interpolate the variable.
- 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 PropertyVariableInterpolator(String string, Object object)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getValue(String variableName)
Retrieves a value for a variable name during interpolation.protected String
toString(Object value)
Convert the given value to a string for interpolation.-
Methods inherited from class org.apache.wicket.util.string.interpolator.VariableInterpolator
toString
-
-
-
-
Constructor Detail
-
PropertyVariableInterpolator
public PropertyVariableInterpolator(String string, Object object)
Constructor.- Parameters:
string
- aString
to interpolate intoobject
- the model to apply property expressions to
-
-
Method Detail
-
getValue
protected String getValue(String variableName)
Description copied from class:VariableInterpolator
Retrieves a value for a variable name during interpolation.- Specified by:
getValue
in classVariableInterpolator
- Parameters:
variableName
- a variable name- Returns:
- the value
-
toString
protected String toString(Object value)
Convert the given value to a string for interpolation.This default implementation delegates to
Strings.toString(Object)
.- Parameters:
value
- the value, nevernull
- Returns:
- string representation
-
-