|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.velocity.app.tools.VelocityFormatter.VelocityAlternator
public class VelocityFormatter.VelocityAlternator
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 |
|---|
protected java.lang.String[] alternates
protected int current
| Constructor Detail |
|---|
public VelocityFormatter.VelocityAlternator(java.lang.String[] alternates)
alternates - A String[].| Method Detail |
|---|
public java.lang.String alternate()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||