FileDocCategorySizeDatePackage
ConditionBase.javaAPI DocApache Ant 1.707401Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.taskdefs.condition

ConditionBase

public abstract class ConditionBase extends org.apache.tools.ant.ProjectComponent implements org.apache.tools.ant.DynamicElement
Baseclass for the <condition> task as well as several conditions - ensures that the types of conditions inside the task and the "container" conditions are in sync.
since
Ant 1.4

Fields Summary
private static final String
CONDITION_ANTLIB
private String
taskName
name of the component
private Vector
conditions
Constructors Summary
protected ConditionBase()
Simple constructor.


           
      
        taskName = "component";
    
protected ConditionBase(String taskName)
Constructor that takes the name of the task in the task name.

param
taskName the name of the task.
since
Ant 1.7

        this.taskName = taskName;
    
Methods Summary
public voidadd(Condition c)
Add an arbitrary condition

param
c a condition
since
Ant 1.6

        conditions.addElement(c);
    
public voidaddAnd(And a)
Add an <and> condition "container".

param
a an And condition
since
1.1

        conditions.addElement(a);
    
public voidaddAvailable(org.apache.tools.ant.taskdefs.Available a)
Add an <available> condition.

param
a an available condition
since
1.1

        conditions.addElement(a);
    
public voidaddChecksum(org.apache.tools.ant.taskdefs.Checksum c)
Add an <checksum> condition.

param
c a Checksum condition
since
1.4, Ant 1.5

        conditions.addElement(c);
    
public voidaddContains(Contains test)
Add a <contains> condition.

param
test a Contains condition
since
Ant 1.5

        conditions.addElement(test);
    
public voidaddEquals(Equals e)
Add an <equals> condition.

param
e an Equals condition
since
1.1

        conditions.addElement(e);
    
public voidaddFilesMatch(FilesMatch test)
Add a <filesmatch> condition.

param
test a FilesMatch condition
since
Ant 1.5

        conditions.addElement(test);
    
public voidaddHttp(Http h)
Add an <http> condition.

param
h an Http condition
since
Ant 1.5

        conditions.addElement(h);
    
public voidaddIsFalse(IsFalse test)
Add a <isfalse> condition.

param
test an IsFalse condition
since
Ant 1.5

        conditions.addElement(test);
    
public voidaddIsFileSelected(IsFileSelected test)
Add an <isfileselected> condition.

param
test the condition

        conditions.addElement(test);
    
public voidaddIsReference(IsReference i)
Add an <isreference> condition.

param
i an IsReference condition
since
Ant 1.6

        conditions.addElement(i);
    
public voidaddIsSet(IsSet i)
Add an <isset> condition.

param
i an IsSet condition
since
Ant 1.5

        conditions.addElement(i);
    
public voidaddIsTrue(IsTrue test)
Add a <istrue> condition.

param
test an IsTrue condition
since
Ant 1.5

        conditions.addElement(test);
    
public voidaddNot(Not n)
Add an <not> condition "container".

param
n a Not condition
since
1.1

        conditions.addElement(n);
    
public voidaddOr(Or o)
Add an <or> condition "container".

param
o an Or condition
since
1.1

        conditions.addElement(o);
    
public voidaddOs(Os o)
Add an <os> condition.

param
o an Os condition
since
1.1

        conditions.addElement(o);
    
public voidaddSocket(Socket s)
Add a <socket> condition.

param
s a Socket condition
since
Ant 1.5

        conditions.addElement(s);
    
public voidaddUptodate(org.apache.tools.ant.taskdefs.UpToDate u)
Add an <uptodate> condition.

param
u an UpToDate condition
since
1.1

        conditions.addElement(u);
    
protected intcountConditions()
Count the conditions.

return
the number of conditions in the container
since
1.1

        return conditions.size();
    
public java.lang.ObjectcreateDynamicElement(java.lang.String name)
Create a dynamically discovered condition. Built-in conditions can be discovered from the org.apache.tools.ant.taskdefs.condition antlib.

param
name the condition to create.
return
the dynamic condition if found, null otherwise.

        Object cond = ComponentHelper.getComponentHelper(getProject())
            .createComponent(CONDITION_ANTLIB + name);
        if (!(cond instanceof Condition)) {
            return null;
        }
        log("Dynamically discovered '" + name + "' " + cond,
            Project.MSG_DEBUG);
        add((Condition) cond);
        return cond;
    
protected final java.util.EnumerationgetConditions()
Iterate through all conditions.

return
an enumeration to use for iteration
since
1.1

        return conditions.elements();
    
public java.lang.StringgetTaskName()
Returns the name to use in logging messages.

return
the name to use in logging messages.
since
Ant 1.7

        return taskName;
    
public voidsetTaskName(java.lang.String name)
Sets the name to use in logging messages.

param
name The name to use in logging messages. Should not be null.
since
Ant 1.7

        this.taskName = name;