net.sf.antcontrib.logic.condition
Class BooleanConditionTask

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.TaskAdapter
                    |
                    +--net.sf.antcontrib.logic.condition.BooleanConditionTask
All Implemented Interfaces:
org.apache.tools.ant.taskdefs.condition.Condition

public class BooleanConditionTask
extends org.apache.tools.ant.TaskAdapter
implements org.apache.tools.ant.taskdefs.condition.Condition

Wraps a ConditionBase so that the If task can use standard Ant Conditions as its evaluated boolean expression. Wrapping like this means that future additions to ConditionBase will automatically be picked up without modifying this class.

Developed for use with Antelope, migrated to ant-contrib Oct 2003.

Version:
$Revision: 1.2 $
Author:
Dale Anson, danson@germane-software.com

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
BooleanConditionTask()
           
 
Method Summary
 boolean eval()
          Evaluates the condition object.
 void execute()
          Forwards to eval().
 java.lang.Object getProxy()
           
 void maybeConfigure()
          Override maybeConfigure in a way that leaves the nested tasks unconfigured until they get executed.
 void setProperty(java.lang.String p)
          The name of the property to set.
 void setProxy(java.lang.Object proxy)
           
 void setValue(java.lang.String v)
          The value for the property to set, if condition evaluates to true.
 
Methods inherited from class org.apache.tools.ant.TaskAdapter
checkTaskClass
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanConditionTask

public BooleanConditionTask()
Method Detail

getProxy

public java.lang.Object getProxy()
Overrides:
getProxy in class org.apache.tools.ant.TaskAdapter

setProxy

public void setProxy(java.lang.Object proxy)
Overrides:
setProxy in class org.apache.tools.ant.TaskAdapter

setProperty

public void setProperty(java.lang.String p)
The name of the property to set. Optional.


setValue

public void setValue(java.lang.String v)
The value for the property to set, if condition evaluates to true. Defaults to "true".


maybeConfigure

public void maybeConfigure()
                    throws org.apache.tools.ant.BuildException
Override maybeConfigure in a way that leaves the nested tasks unconfigured until they get executed.

Overrides:
maybeConfigure in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
Since:
Ant 1.5

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Forwards to eval().

Overrides:
execute in class org.apache.tools.ant.TaskAdapter
org.apache.tools.ant.BuildException

eval

public boolean eval()
Evaluates the condition object.

Specified by:
eval in interface org.apache.tools.ant.taskdefs.condition.Condition
Returns:
true or false, depending on the evaluation of the condition.