org.apache.velocity.app.tools
Class VelocityFormatter.VelocityAlternator
java.lang.Object
org.apache.velocity.app.tools.VelocityFormatter.VelocityAlternator
- VelocityFormatter
public class VelocityFormatter.VelocityAlternator
extends java.lang.Object
Class that returns alternating values in a template. It stores
a list of alternate Strings, whenever alternate() is called it
switches to the next in the list. The current alternate is
retrieved through toString() - i.e. just by referencing the
object in a Velocity template. For an example of usage see the
makeAlternator() method below.
String | alternate() - Alternates to the next in the list.
|
String | toString() - Returns the current alternate.
|
alternates
protected String[] alternates
current
protected int current
VelocityAlternator
public VelocityAlternator(String[] alternates)
Constructor takes an array of Strings.
alternate
public String alternate()
Alternates to the next in the list.
- The current alternate in the sequence.
toString
public String toString()
Returns the current alternate.
Copyright B) 2002 Apache Software Foundation. All Rights Reserved.