org.apache.wicket.util.string.interpolator
Class PropertyVariableInterpolator
java.lang.Object
org.apache.wicket.util.string.interpolator.VariableInterpolator
org.apache.wicket.util.string.interpolator.PropertyVariableInterpolator
public final class PropertyVariableInterpolator
- extends VariableInterpolator
Interpolates values into String
s that are produced by interpreting property
expressions against a beans model.
The interpolate(String string, Object model)
method takes a string such as "
My name is ${name}
" and a beans model 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 interpolate()
would
return "My name is Jonathan"
.
"$" is the escape char. Thus "$${text}" can be used to escape it (ignore interpretation).
- Since:
- 1.2.6
- Author:
- Jonathan Locke
Method Summary |
protected String |
getValue(String variableName)
Retrieves a value for a variable name during interpolation. |
static String |
interpolate(String string,
Object object)
Interpolates the given String , substituting values for property expressions. |
interpolate
public static String interpolate(String string,
Object object)
- Interpolates the given
String
, substituting values for property expressions.
- Parameters:
string
- a String
containing property expressions like ${xyz}
object
- the Object
to reflect on
- Returns:
- the interpolated
String
getValue
protected String getValue(String variableName)
- Retrieves a value for a variable name during interpolation.
- Specified by:
getValue
in class VariableInterpolator
- Parameters:
variableName
- the variable name
- Returns:
- the value
Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.