类 AlternatorTool
java.lang.Object
org.apache.velocity.tools.generic.SafeConfig
org.apache.velocity.tools.generic.AlternatorTool
Simple tool to provide easy in-template instantiation of
Alternator
s 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.
- 从以下版本开始:
- Velocity Tools 1.2
- 版本:
- $Revision: 671010 $ $Date: 2008-06-23 20:40:41 -0700 (Mon, 23 Jun 2008) $
-
字段概要
字段从类继承的字段 org.apache.velocity.tools.generic.SafeConfig
LOCK_CONFIG_KEY, OLD_LOCK_CONFIG_KEY, SAFE_MODE_KEY
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Make an automaticAlternator
from the specified objects.已过时。Will be unnecessary with Velocity 1.6auto
(Collection list) 已过时。Will be unnecessary with Velocity 1.6protected void
configure
(ValueParser parser) Looks for a default auto-alternate value in the given params, if not, set the default to true.boolean
Returns true if the default for auto-alternating is true.Returns a new Alternator for the specified list with the specified automatic shifting preference.已过时。Will be unnecessary with Velocity 1.6make
(boolean auto, Collection list) 已过时。Will be unnecessary with Velocity 1.6Make an automaticAlternator
from the specifed objects.已过时。Will be unnecessary with Velocity 1.6make
(Collection list) 已过时。Will be unnecessary with Velocity 1.6Make a manualAlternator
from the specified objects.已过时。Will be unnecessary with Velocity 1.6manual
(Collection list) 已过时。Will be unnecessary with Velocity 1.6protected void
setAutoAlternateDefault
(boolean bool) Sets the default for auto-alternating.从类继承的方法 org.apache.velocity.tools.generic.SafeConfig
configure, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
-
字段详细资料
-
构造器详细资料
-
AlternatorTool
public AlternatorTool()
-
-
方法详细资料
-
configure
Looks for a default auto-alternate value in the given params, if not, set the default to true.- 覆盖:
configure
在类中SafeConfig
-
getAutoAlternateDefault
public boolean getAutoAlternateDefault()Returns true if the default for auto-alternating is true.- 从以下版本开始:
- VelocityTools 1.3
-
setAutoAlternateDefault
protected void setAutoAlternateDefault(boolean bool) Sets the default for auto-alternating.- 从以下版本开始:
- VelocityTools 1.3
-
make
Make an automaticAlternator
from the specifed objects. -
make
已过时。Will be unnecessary with Velocity 1.6 -
make
Returns a new Alternator for the specified list with the specified automatic shifting preference.- 参数:
auto
- SeeAlternator.setAuto(boolean auto)
.list
- The list of elements to alternate.
-
make
已过时。Will be unnecessary with Velocity 1.6 -
make
已过时。Will be unnecessary with Velocity 1.6 -
make
已过时。Will be unnecessary with Velocity 1.6 -
auto
Make an automaticAlternator
from the specified objects.- 返回:
- a new, automatic Alternator with the specified values or
null
if there are none specified. - 从以下版本开始:
- VelocityTools 1.3
-
auto
已过时。Will be unnecessary with Velocity 1.6 -
auto
已过时。Will be unnecessary with Velocity 1.6 -
manual
Make a manualAlternator
from the specified objects.- 返回:
- a new, manual Alternator with the values in the array or
null
if the array isnull
. - 从以下版本开始:
- VelocityTools 1.3
-
manual
已过时。Will be unnecessary with Velocity 1.6 -
manual
已过时。Will be unnecessary with Velocity 1.6
-