|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.velocity.tools.generic.SafeConfig
org.apache.velocity.tools.generic.AlternatorTool
@DefaultKey(value="alternator") public class AlternatorTool
Simple tool to provide easy in-template instantiation of
Alternators from varying "list" types or individual
arguments.
Example Use:
tools.xml...
<tools>
<toolbox scope="application">
<tool class="org.apache.velocity.tools.generic.AlternatorTool"/>
</toolbox>
</tools>
template...
#set( $color = $alternator.auto('red', 'blue') )
## use manual alternation for this one
#set( $style = $alternator.manual('hip','fly','groovy') )
#foreach( $i in [1..5] )
Number $i is $color and $style. I dig $style.next numbers.
#end *
output...
Number 1 is red and hip. I dig hip numbers.
Number 2 is blue and fly. I dig fly numbers.
Number 3 is red and groovy. I dig groovy numbers.
Number 4 is blue and hip. I dig hip numbers.
Number 5 is red and fly. I dig fly numbers.
| Field Summary | |
|---|---|
static java.lang.String |
AUTO_ALTERNATE_DEFAULT_KEY
|
private boolean |
autoAlternateDefault
|
static java.lang.String |
OLD_AUTO_ALTERNATE_DEFAULT_KEY
Deprecated. |
| Fields inherited from class org.apache.velocity.tools.generic.SafeConfig |
|---|
LOCK_CONFIG_KEY, OLD_LOCK_CONFIG_KEY, SAFE_MODE_KEY |
| Constructor Summary | |
|---|---|
AlternatorTool()
|
|
| Method Summary | |
|---|---|
Alternator |
auto(java.util.Collection list)
Deprecated. Will be unnecessary with Velocity 1.6 |
Alternator |
auto(java.lang.Object... list)
Make an automatic Alternator from the specified objects. |
Alternator |
auto(java.lang.Object o1,
java.lang.Object o2)
Deprecated. Will be unnecessary with Velocity 1.6 |
protected void |
configure(ValueParser parser)
Looks for a default auto-alternate value in the given params, if not, set the default to true. |
boolean |
getAutoAlternateDefault()
Returns true if the default for auto-alternating is true. |
Alternator |
make(boolean auto,
java.util.Collection list)
Deprecated. Will be unnecessary with Velocity 1.6 |
Alternator |
make(boolean auto,
java.lang.Object... list)
Returns a new Alternator for the specified list with the specified automatic shifting preference. |
Alternator |
make(boolean auto,
java.lang.Object o1,
java.lang.Object o2)
Deprecated. Will be unnecessary with Velocity 1.6 |
Alternator |
make(java.util.Collection list)
Deprecated. Will be unnecessary with Velocity 1.6 |
Alternator |
make(java.lang.Object... list)
Make an automatic Alternator from the specifed objects. |
Alternator |
make(java.lang.Object o1,
java.lang.Object o2)
Deprecated. Will be unnecessary with Velocity 1.6 |
Alternator |
manual(java.util.Collection list)
Deprecated. Will be unnecessary with Velocity 1.6 |
Alternator |
manual(java.lang.Object... list)
Make a manual Alternator from the specified objects. |
Alternator |
manual(java.lang.Object o1,
java.lang.Object o2)
Deprecated. Will be unnecessary with Velocity 1.6 |
protected void |
setAutoAlternateDefault(boolean bool)
Sets the default for auto-alternating. |
| Methods inherited from class org.apache.velocity.tools.generic.SafeConfig |
|---|
configure, isConfigLocked, isSafeMode, setLockConfig, setSafeMode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Deprecated public static final java.lang.String OLD_AUTO_ALTERNATE_DEFAULT_KEY
public static final java.lang.String AUTO_ALTERNATE_DEFAULT_KEY
private boolean autoAlternateDefault
| Constructor Detail |
|---|
public AlternatorTool()
| Method Detail |
|---|
protected void configure(ValueParser parser)
configure in class SafeConfigpublic boolean getAutoAlternateDefault()
protected void setAutoAlternateDefault(boolean bool)
public Alternator make(java.lang.Object... list)
Alternator from the specifed objects.
@Deprecated public Alternator make(java.util.Collection list)
public Alternator make(boolean auto,
java.lang.Object... list)
auto - See Alternator.setAuto(boolean auto).list - The list of elements to alternate.
@Deprecated
public Alternator make(boolean auto,
java.util.Collection list)
@Deprecated
public Alternator make(java.lang.Object o1,
java.lang.Object o2)
@Deprecated
public Alternator make(boolean auto,
java.lang.Object o1,
java.lang.Object o2)
public Alternator auto(java.lang.Object... list)
Alternator from the specified objects.
null if there are none specified.@Deprecated public Alternator auto(java.util.Collection list)
@Deprecated
public Alternator auto(java.lang.Object o1,
java.lang.Object o2)
public Alternator manual(java.lang.Object... list)
Alternator from the specified objects.
null if the array is null.@Deprecated public Alternator manual(java.util.Collection list)
@Deprecated
public Alternator manual(java.lang.Object o1,
java.lang.Object o2)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||