wicket.util.string.interpolator
Class VariableInterpolator

java.lang.Object
  extended by wicket.util.string.interpolator.VariableInterpolator
Direct Known Subclasses:
MapVariableInterpolator, PropertyVariableInterpolator

public abstract class VariableInterpolator
extends java.lang.Object

Base class for variable interpolators. An interpolator substitutes values into a string. So a variable interpolator substitutes the values of one or more variables into a string.

The String to interpolate (substitute in) is passed to the VariableInterpolator constructor. Variables are denoted in this string by the syntax ${variableName}. A subclass provides an implementation for the abstract method getValue(String variableName). The toString() method then performs an interpolation by replacing each variable of the form ${variableName} with the value returned by getValue("variableName").

Author:
Jonathan Locke

Field Summary
protected  java.lang.String string
          The string to interpolate within
 
Constructor Summary
VariableInterpolator(java.lang.String string)
          Constructor
 
Method Summary
protected abstract  java.lang.String getValue(java.lang.String variableName)
          Gets a value for a variable name during interpolation
 java.lang.String toString()
          Interpolate using variables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

string

protected final java.lang.String string
The string to interpolate within

Constructor Detail

VariableInterpolator

public VariableInterpolator(java.lang.String string)
Constructor

Parameters:
string - String to interpolate with variable values
Method Detail

getValue

protected abstract java.lang.String getValue(java.lang.String variableName)
Gets a value for a variable name during interpolation

Parameters:
variableName - The variable
Returns:
The value

toString

public java.lang.String toString()
Interpolate using variables

Overrides:
toString in class java.lang.Object
Returns:
The interpolated string


Copyright © 2004-2007 Wicket developers. All Rights Reserved.