Package 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 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.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String[]
alternates
protected int
current
-
Constructor Summary
Constructors Constructor Description VelocityAlternator(java.lang.String[] alternates)
Constructor takes an array of Strings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
alternate()
Alternates to the next in the list.java.lang.String
toString()
Returns the current alternate.
-