org.apache.wicket.core.util.string.interpolator
Class PropertyVariableInterpolator

java.lang.Object
  extended by org.apache.wicket.util.string.interpolator.VariableInterpolator
      extended by org.apache.wicket.core.util.string.interpolator.PropertyVariableInterpolator
All Implemented Interfaces:
Serializable, IClusterable
Direct Known Subclasses:
ConvertingPropertyVariableInterpolator

public class PropertyVariableInterpolator
extends VariableInterpolator

Interpolates values into Strings 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:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.wicket.util.string.interpolator.VariableInterpolator
string
 
Constructor Summary
PropertyVariableInterpolator(String string, Object object)
          Constructor.
 
Method Summary
protected  String getValue(String variableName)
           
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyVariableInterpolator

public PropertyVariableInterpolator(String string,
                                    Object object)
Constructor.

Parameters:
string - a String to interpolate into
object - the model to apply property expressions to
Method Detail

getValue

protected String getValue(String variableName)
Specified by:
getValue in class VariableInterpolator

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, never null
Returns:
string representation


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.