Package ise.antelope.tasks
Class IfTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
ise.antelope.tasks.IfTask
public class IfTask
extends org.apache.tools.ant.Task
implements org.apache.tools.ant.TaskContainer, Breakable
Similar to Java's 'if' keyword, verifies that a given property has a given
value and executes embedded tasks if it does. Does nothing if the property
value is not as expected or the property does not exist.
Can hold other tasks including IfTask, in particular, an ElseTask and a Break.
- Since:
- Ant 1.5
-
Field Summary
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapperFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBool(BooleanConditionTask boolTask) voidRequired by Breakable.voidvoidaddTask(org.apache.tools.ant.Task task) Add a nested task to execute.booleandoBreak()Required by Breakable.voidexecute()Execute this task and all nested Tasks, checking for Breaks and Breakables.voidinit()Automatically define dependent tasks.voidOverridemaybeConfigurein a way that leaves the nested tasks unconfigured until they get executed.voidsetBreak(boolean b) Required by Breakable.voidSet the 'exists' attribute.voidSet the name of the property to test.voidSet the expected value of the property.Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Constructor Details
-
IfTask
public IfTask()
-
-
Method Details
-
init
public void init()Automatically define dependent tasks.- Overrides:
initin classorg.apache.tools.ant.Task
-
setName
Set the name of the property to test. Required unless nested condition is used.- Parameters:
name- the name of the property to test.
-
setValue
Set the expected value of the property. Implies 'exists'.executemethod throws BuildException if the actual value is not the same as this value. Optional.- Parameters:
value- the expected value of the property.
-
setExists
Set the 'exists' attribute. If true, throws BuildException if the property does not exist. Optional, default is true.- Parameters:
exists- Ant boolean, whether the value must exist.
-
setBreak
public void setBreak(boolean b) Required by Breakable. -
addBreak
Required by Breakable. -
addElse
-
addBool
-
doBreak
public boolean doBreak()Required by Breakable. -
maybeConfigure
public void maybeConfigure() throws org.apache.tools.ant.BuildExceptionOverridemaybeConfigurein a way that leaves the nested tasks unconfigured until they get executed.- Overrides:
maybeConfigurein classorg.apache.tools.ant.Task- Throws:
org.apache.tools.ant.BuildException- Description of the Exception- Since:
- Ant 1.5
-
addTask
public void addTask(org.apache.tools.ant.Task task) Add a nested task to execute.- Specified by:
addTaskin interfaceorg.apache.tools.ant.TaskContainer- Parameters:
task- Nested task to execute.
-
execute
public void execute() throws org.apache.tools.ant.BuildExceptionExecute this task and all nested Tasks, checking for Breaks and Breakables.- Overrides:
executein classorg.apache.tools.ant.Task- Throws:
org.apache.tools.ant.BuildException- Description of the Exception
-