Alternator - Documentation topics on: alternator,.

Alternator

org.apache.velocity.tools.generic
Class Alternator

java.lang.Object
extended byorg.apache.velocity.tools.generic.Alternator

public class Alternator
extends java.lang.Object

Utility class for easily alternating over values in a list.

Example usage:

 java...
String[] myColors = new String[]{"red", "blue"};
context.put("color", new Alternator(myColors));
String[] myStyles = new String[]{"hip", "fly", "groovy"};
// demonstrate manual alternation with this one
context.put("style", new Alternator(false, myStyles));

template...

1 is $color and $style.next

2 is $color and $style.next

3 is $color and $style.next

4 is $color and $style.next

5 is $color and $style.next


output...
1 is red and hip
2 is blue and fly
3 is red and groovy
4 is blue and hip
5 is red and fly
Since:
Velocity Tools 1.2
Version:
$Revision: 72057 $ $Date: 2004-05-05 17:36:40 -0700 (Wed, 05 May 2004) $

For complete documentation on this viewtool use the following link: Alternator