Class ConditionTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.taskdefs.condition.ConditionBase
org.apache.tools.ant.taskdefs.ConditionTask
- All Implemented Interfaces:
Cloneable
Task to set a property conditionally using <uptodate>, <available>,
and many other supported conditions.
This task supports boolean logic as well as pluggable conditions to decide, whether a property should be set.
This task does not extend Task to take advantage of ConditionBase.
- Since:
- Ant 1.4
-
Field Summary
Fields inherited from class ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()See whether our nested condition holds and set the property.voidThe value for the property to set, if condition evaluates to false.voidThe value for the property to set, if condition evaluates to false.voidThe name of the property to set.voidThe value for the property to set, if condition evaluates to true.voidThe value for the property to set, if condition evaluates to true.Methods inherited from class ConditionBase
add, addAnd, addAvailable, addChecksum, addContains, addEquals, addFilesMatch, addHttp, addIsFalse, addIsFileSelected, addIsReference, addIsSet, addIsTrue, addNot, addOr, addOs, addSocket, addUptodate, countConditions, getConditions, getTaskName, setTaskNameModifier and TypeMethodDescriptionvoidAdd an arbitrary conditionvoidAdd an <and> condition "container".voidAdd an <available> condition.voidAdd an <checksum> condition.voidaddContains(Contains test) Add a <contains> condition.voidAdd an <equals> condition.voidaddFilesMatch(FilesMatch test) Add a <filesmatch> condition.voidAdd an <http> condition.voidaddIsFalse(IsFalse test) Add a <isfalse> condition.voidAdd an <isfileselected> condition.voidAdd an <isreference> condition.voidAdd an <isset> condition.voidAdd a <istrue> condition.voidAdd an <not> condition "container".voidAdd an <or> condition "container".voidAdd an <os> condition.voidAdd a <socket> condition.voidAdd an <uptodate> condition.protected intCount the conditions.protected final Enumeration<Condition> Iterate through all conditions.Returns the name to use in logging messages.voidsetTaskName(String name) Sets the name to use in logging messages.Methods inherited from class ProjectComponent
clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProjectModifier and TypeMethodDescriptionclone()Returns the description of the current action.Returns the file/location where this task was defined.Returns the project to which this component belongs.voidLogs a message with the default (INFO) priority.voidLogs a message with the given priority.voidsetDescription(String desc) Sets a description of the current action.voidsetLocation(Location location) Sets the file/location where this task was defined.voidsetProject(Project project) Sets the project object of this component.
-
Constructor Details
-
ConditionTask
public ConditionTask()Constructor, names this task "condition".
-
-
Method Details
-
setProperty
The name of the property to set. Required.- Parameters:
p- the name of the property- Since:
- Ant 1.4
-
setValue
The value for the property to set, if condition evaluates to true. Defaults to "true".- Parameters:
value- the (Object) value of the property- Since:
- Ant 1.8
-
setValue
The value for the property to set, if condition evaluates to true. Defaults to "true".- Parameters:
v- the value of the property- Since:
- Ant 1.4
-
setElse
The value for the property to set, if condition evaluates to false. If this attribute is not specified, the property will not be set.- Parameters:
alt- the alternate value of the property.- Since:
- Ant 1.8
-
setElse
The value for the property to set, if condition evaluates to false. If this attribute is not specified, the property will not be set.- Parameters:
e- the alternate value of the property.- Since:
- Ant 1.6.3
-
execute
See whether our nested condition holds and set the property.- Throws:
BuildException- if an error occurs- Since:
- Ant 1.4
-