net.sf.antcontrib.logic

Class For

public class For extends Task

Task 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
For()
Creates a new For instance.
Method Summary
voidadd(Map map)
Add a Map, iterate over the values
voidadd(FileSet fileset)
Add a fileset to be iterated over.
voidadd(DirSet dirset)
Add a dirset to be iterated over.
voidadd(Collection collection)
Add a collection that can be iterated over.
voidadd(Iterator iterator)
Add an iterator to be iterated over.
voidadd(Object obj)
Add an object that has an Iterator iterator() method that can be iterated over.
voidaddConfigured(Path path)
This is a path that can be used instread of the list attribute to interate over.
voidaddConfiguredPath(Path path)
This is a path that can be used instread of the list attribute to interate over.
voidaddDirSet(DirSet dirset)
Add a dirset to be iterated over.
voidaddFileSet(FileSet fileset)
Add a fileset to be iterated over.
ObjectcreateSequential()
voidexecute()
Run the for task.
voidsetDelimiter(String delimiter)
Set the delimiter attribute.
voidsetKeepgoing(boolean keepgoing)
Set the keepgoing attribute, indicating whether we should stop on errors or continue heedlessly onward.
voidsetList(String list)
Set the list attribute.
voidsetOwningTarget(Target target)
voidsetParallel(boolean parallel)
Attribute whether to execute the loop in parallel or in sequence.
voidsetParam(String param)
Set the param attribute.
voidsetProject(Project project)
voidsetThreadCount(int threadCount)
Set the maximum amount of threads we're going to allow to execute in parallel
voidsetTrim(boolean trim)
Set the trim attribute.

Constructor Detail

For

public For()
Creates a new For instance. This checks if the ant version is correct to run this task.

Method Detail

add

public void add(Map map)
Add a Map, iterate over the values

Parameters: map a Map object - iterate over the values.

add

public void add(FileSet fileset)
Add a fileset to be iterated over.

Parameters: fileset a FileSet value

add

public void add(DirSet dirset)
Add a dirset to be iterated over.

Parameters: dirset a DirSet value

add

public void add(Collection collection)
Add a collection that can be iterated over.

Parameters: collection a Collection value.

add

public void add(Iterator iterator)
Add an iterator to be iterated over.

Parameters: iterator an Iterator value

add

public void add(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.

addConfigured

public void addConfigured(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(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.

addDirSet

public void addDirSet(DirSet dirset)
Add a dirset to be iterated over.

Parameters: dirset a DirSet value

addFileSet

public void addFileSet(FileSet fileset)
Add a fileset to be iterated over.

Parameters: fileset a FileSet value

createSequential

public Object createSequential()

Returns: a MacroDef#NestedSequential object to be configured

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.

setDelimiter

public void setDelimiter(String delimiter)
Set the delimiter attribute.

Parameters: delimiter the delimiter used to separate the tokens in the list attribute. The default is ",".

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, if true then we act in the keepgoing manner described.

setList

public void setList(String list)
Set the list attribute.

Parameters: list a list of delimiter separated tokens.

setOwningTarget

public void setOwningTarget(Target target)

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.

setParam

public void setParam(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.

setProject

public void setProject(Project project)

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.