Package net.sf.antcontrib.logic
Class ForTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- net.sf.antcontrib.logic.ForTask
-
- All Implemented Interfaces:
java.lang.Cloneable
public class ForTask extends org.apache.tools.ant.TaskTask definition for the for task. This is based on the foreach task but takes a sequential element instead of a target and only works for ant >= 1.6Beta3- Author:
- Peter Reilly
-
-
Constructor Summary
Constructors Constructor Description ForTask()Creates a newForinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.Object obj)Add an object that has an Iterator iterator() method that can be iterated over.voidadd(java.util.Collection collection)Add a collection that can be iterated over.voidadd(java.util.Iterator iterator)Add an iterator to be iterated over.voidadd(java.util.Map map)Add a Map, iterate over the valuesvoidadd(org.apache.tools.ant.types.DirSet dirset)Add a dirset to be iterated over.voidadd(org.apache.tools.ant.types.FileSet fileset)Add a fileset to be iterated over.voidaddConfigured(org.apache.tools.ant.types.Path path)This is a path that can be used instread of the list attribute to interate over.voidaddConfiguredPath(org.apache.tools.ant.types.Path path)This is a path that can be used instread of the list attribute to interate over.voidaddDirSet(org.apache.tools.ant.types.DirSet dirset)Add a dirset to be iterated over.voidaddFileSet(org.apache.tools.ant.types.FileSet fileset)Add a fileset to be iterated over.java.lang.ObjectcreateSequential()voidexecute()Run the for task.voidsetBegin(int begin)Set begin attribute.voidsetDelimiter(java.lang.String delimiter)Set the delimiter attribute.voidsetEnd(java.lang.Integer end)Set end attribute.voidsetKeepgoing(boolean keepgoing)Set the keepgoing attribute, indicating whether we should stop on errors or continue heedlessly onward.voidsetList(java.lang.String list)Set the list attribute.voidsetParallel(boolean parallel)Attribute whether to execute the loop in parallel or in sequence.voidsetParam(java.lang.String param)Set the param attribute.voidsetStep(int step)Set step attribute.voidsetThreadCount(int threadCount)Set the maximum amount of threads we're going to allow to execute in parallelvoidsetTrim(boolean trim)Set the trim attribute.-
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
-
-
-
Method Detail
-
setParallel
public void setParallel(boolean parallel)
Attribute whether to execute the loop in parallel or in sequence.- Parameters:
parallel- if true execute the tasks in parallel. Default is false.
-
setThreadCount
public void setThreadCount(int threadCount)
Set the maximum amount of threads we're going to allow to execute in parallel- Parameters:
threadCount- the number of threads to use
-
setTrim
public void setTrim(boolean trim)
Set the trim attribute.- Parameters:
trim- if true, trim the value for each iterator.
-
setKeepgoing
public void setKeepgoing(boolean keepgoing)
Set the keepgoing attribute, indicating whether we should stop on errors or continue heedlessly onward.- Parameters:
keepgoing- a boolean, iftruethen we act in the keepgoing manner described.
-
setList
public void setList(java.lang.String list)
Set the list attribute.- Parameters:
list- a list of delimiter separated tokens.
-
setDelimiter
public void setDelimiter(java.lang.String delimiter)
Set the delimiter attribute.- Parameters:
delimiter- the delimiter used to separate the tokens in the list attribute. The default is ",".
-
setParam
public void setParam(java.lang.String param)
Set the param attribute. This is the name of the macrodef attribute that gets set for each iterator of the sequential element.- Parameters:
param- the name of the macrodef attribute.
-
addConfigured
public void addConfigured(org.apache.tools.ant.types.Path path)
This is a path that can be used instread of the list attribute to interate over. If this is set, each path element in the path is used for an interator of the sequential element.- Parameters:
path- the path to be set by the ant script.
-
addConfiguredPath
public void addConfiguredPath(org.apache.tools.ant.types.Path path)
This is a path that can be used instread of the list attribute to interate over. If this is set, each path element in the path is used for an interator of the sequential element.- Parameters:
path- the path to be set by the ant script.
-
createSequential
public java.lang.Object createSequential()
- Returns:
- a MacroDef#NestedSequential object to be configured
-
setBegin
public void setBegin(int begin)
Set begin attribute.- Parameters:
begin- the value to use.
-
setEnd
public void setEnd(java.lang.Integer end)
Set end attribute.- Parameters:
end- the value to use.
-
setStep
public void setStep(int step)
Set step attribute.
-
execute
public void execute()
Run the for task. This checks the attributes and nested elements, and if there are ok, it calls doTheTasks() which constructes a macrodef task and a for each interation a macrodef instance.- Overrides:
executein classorg.apache.tools.ant.Task
-
add
public void add(java.util.Map map)
Add a Map, iterate over the values- Parameters:
map- a Map object - iterate over the values.
-
add
public void add(org.apache.tools.ant.types.FileSet fileset)
Add a fileset to be iterated over.- Parameters:
fileset- aFileSetvalue
-
addFileSet
public void addFileSet(org.apache.tools.ant.types.FileSet fileset)
Add a fileset to be iterated over.- Parameters:
fileset- aFileSetvalue
-
add
public void add(org.apache.tools.ant.types.DirSet dirset)
Add a dirset to be iterated over.- Parameters:
dirset- aDirSetvalue
-
addDirSet
public void addDirSet(org.apache.tools.ant.types.DirSet dirset)
Add a dirset to be iterated over.- Parameters:
dirset- aDirSetvalue
-
add
public void add(java.util.Collection collection)
Add a collection that can be iterated over.- Parameters:
collection- aCollectionvalue.
-
add
public void add(java.util.Iterator iterator)
Add an iterator to be iterated over.- Parameters:
iterator- anIteratorvalue
-
add
public void add(java.lang.Object obj)
Add an object that has an Iterator iterator() method that can be iterated over.- Parameters:
obj- An object that can be iterated over.
-
-