net.sf.antcontrib.logic

Class ForEach

public class ForEach extends Task

Task definition for the foreach task. The foreach task iterates over a list, a list of filesets, or both.

 Usage:

   Task declaration in the project:
   
     <taskdef name="foreach" classname="net.sf.antcontrib.logic.ForEach" />
   

   Call Syntax:
   
     <foreach list="values" target="targ" param="name"
                 [parallel="true|false"]
                 [delimiter="delim"] />
   

   Attributes:
         list      --> The list of values to process, with the delimiter character,
                       indicated by the "delim" attribute, separating each value
         target    --> The target to call for each token, passing the token as the
                       parameter with the name indicated by the "param" attribute
         param     --> The name of the parameter to pass the tokens in as to the
                       target
         delimiter --> The delimiter string that separates the values in the "list"
                       parameter.  The default is ","
         parallel  --> Should all targets execute in parallel.  The default is false.
         trim      --> Should we trim the list item before calling the target?

 

Author: Matthew Inger

Constructor Summary
ForEach()
Default Constructor
Method Summary
voidaddFileset(FileSet set)
voidaddParam(Property p)
Corresponds to <antcall>'s nested <param> element.
voidaddReference(Reference r)
Corresponds to <antcall>'s nested <reference> element.
MappercreateMapper()
PathcreatePath()
voidexecute()
protected voidhandleErrorOutput(String line)
protected voidhandleOutput(String line)
voidsetDelimiter(String delimiter)
voidsetInheritall(boolean b)
Corresponds to <antcall>'s inheritall attribute.
voidsetInheritrefs(boolean b)
Corresponds to <antcall>'s inheritrefs attribute.
voidsetList(String list)
voidsetMaxThreads(int maxThreads)
Set the maximum amount of threads we're going to allow at once to execute
voidsetParallel(boolean parallel)
voidsetParam(String param)
voidsetTarget(String target)
voidsetTrim(boolean trim)

Constructor Detail

ForEach

public ForEach()
Default Constructor

Method Detail

addFileset

public void addFileset(FileSet set)

Deprecated: Use createPath instead.

addParam

public void addParam(Property p)
Corresponds to <antcall>'s nested <param> element.

addReference

public void addReference(Reference r)
Corresponds to <antcall>'s nested <reference> element.

createMapper

public Mapper createMapper()

createPath

public Path createPath()

execute

public void execute()

handleErrorOutput

protected void handleErrorOutput(String line)

handleOutput

protected void handleOutput(String line)

setDelimiter

public void setDelimiter(String delimiter)

setInheritall

public void setInheritall(boolean b)
Corresponds to <antcall>'s inheritall attribute.

setInheritrefs

public void setInheritrefs(boolean b)
Corresponds to <antcall>'s inheritrefs attribute.

setList

public void setList(String list)

setMaxThreads

public void setMaxThreads(int maxThreads)
Set the maximum amount of threads we're going to allow at once to execute

Parameters: maxThreads

setParallel

public void setParallel(boolean parallel)

setParam

public void setParam(String param)

setTarget

public void setTarget(String target)

setTrim

public void setTrim(boolean trim)