org.apache.turbine.util.webmacro
Class WebMacroFormatter.WebMacroAlternator

java.lang.Object
  |
  +--org.apache.turbine.util.webmacro.WebMacroFormatter.WebMacroAlternator
Enclosing class:
WebMacroFormatter

public class WebMacroFormatter.WebMacroAlternator
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 webmacro template. For an example of usage see the makeAlternator() method below.


Field Summary
(package private)  java.lang.String[] alternates
           
(package private)  int current
           
 
Constructor Summary
WebMacroFormatter.WebMacroAlternator(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, registerNatives, wait, wait, wait
 

Field Detail

alternates

java.lang.String[] alternates

current

int current
Constructor Detail

WebMacroFormatter.WebMacroAlternator

public WebMacroFormatter.WebMacroAlternator(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:
A String.

toString

public java.lang.String toString()
Returns the current alternate.
Overrides:
toString in class java.lang.Object
Returns:
A String.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.