VelocityFormatter.VelocityAlternator (Velocity 1.4 API)
Keywords: org.apache.velocity.app.tools.VelocityFormatter.VelocityAlternator class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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
`protected java.lang.String[]` | `alternates`
`protected int` | `current`

Constructor Summary
`VelocityFormatter.VelocityAlternator(java.lang.String[] alternates)` Constructor takes an array of Strings.

Method Summary
`java.lang.String` | `alternate()` Alternates to the next in the list.
`java.lang.String` | `toString()` Returns the current alternate.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### alternates

    protected java.lang.String[] alternates

### current

    protected int current

Constructor Detail

### VelocityFormatter.VelocityAlternator

    public VelocityFormatter.VelocityAlternator(java.lang.String[] alternates)

  Constructor takes an array of Strings.

Parameters:
  `alternates` - A String[].

Method Detail

### alternate

    public java.lang.String alternate()

  Alternates to the next in the list.

  Returns:
    The current alternate in the sequence.

### toString

    public java.lang.String toString()

  Returns the current alternate.

  Returns:
    A String.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 Apache Software Foundation. All Rights Reserved.