Module org.apache.wicket.core
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
Interpolates values into
String
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 a Person
, and reflects on the object using any property expressions found inside ${}
markers
in the String
. In this case, if the Person
model has a
getName()
method. The results of calling that method would be substituted for
${name}
. If getName()
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:
-
Field Summary
Fields inherited from class org.apache.wicket.util.string.interpolator.VariableInterpolator
string
-
Constructor Summary
-
Method Summary
Methods inherited from class org.apache.wicket.util.string.interpolator.VariableInterpolator
toString
-
Constructor Details
-
PropertyVariableInterpolator
Constructor.- Parameters:
string
- aString
to interpolate intoobject
- the model to apply property expressions to
-
-
Method Details
-
getValue
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
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
-