|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.util.string.interpolator.VariableInterpolator
public abstract class VariableInterpolator
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 into) is passed to the
VariableInterpolator
's 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")
.
Field Summary | |
---|---|
protected java.lang.String |
string
The String to interpolate into |
Constructor Summary | |
---|---|
VariableInterpolator(java.lang.String string)
Constructor. |
|
VariableInterpolator(java.lang.String string,
boolean exceptionOnNullVarValue)
Constructor. |
Method Summary | |
---|---|
protected abstract java.lang.String |
getValue(java.lang.String variableName)
Retrieves a value for a variable name during interpolation. |
java.lang.String |
toString()
Interpolates using variables. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final java.lang.String string
String
to interpolate into
Constructor Detail |
---|
public VariableInterpolator(java.lang.String string)
string
- a String
to interpolate with variable valuespublic VariableInterpolator(java.lang.String string, boolean exceptionOnNullVarValue)
string
- a String
to interpolate with variable valuesexceptionOnNullVarValue
- if true
an IllegalStateException
will be thrown if
getValue(String)
returns null
, otherwise the
${varname}
string will be left in the String
so that
multiple interpolators can be chainedMethod Detail |
---|
protected abstract java.lang.String getValue(java.lang.String variableName)
variableName
- a variable name
public java.lang.String toString()
toString
in class java.lang.Object
String
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |