org.apache.velocity.app.tools
Class VelocityFormatter.VelocityAlternator
java.lang.Object
org.apache.velocity.app.tools.VelocityFormatter.VelocityAlternator
- Direct Known Subclasses:
- VelocityFormatter.VelocityAutoAlternator
- Enclosing class:
- VelocityFormatter
public class VelocityFormatter.VelocityAlternator
- extends 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.
alternates
protected String[] alternates
current
protected int current
VelocityFormatter.VelocityAlternator
public VelocityFormatter.VelocityAlternator(String[] alternates)
- Constructor takes an array of Strings.
- Parameters:
alternates
- A String[].
alternate
public String alternate()
- Alternates to the next in the list.
- Returns:
- The current alternate in the sequence.
toString
public String toString()
- Returns the current alternate.
- Overrides:
toString
in class Object
- Returns:
- A String.
Copyright © 2000-2008 The Apache Software Foundation. All Rights Reserved.