net.sf.antcontrib.property
Class Variable
Task
net.sf.antcontrib.property.Variable
public class Variable
extends Task
Similar to Property, but this property is mutable. In fact, much of the code
in this class is copy and paste from Property. In general, the standard Ant
property should be used, but occasionally it is useful to use a mutable
property.
This used to be a nice little task that took advantage of what is probably
a flaw in the Ant Project API -- setting a "user" property programatically
causes the project to overwrite a previously set property. Now this task
has become more violent and employs a technique known as "object rape" to
directly access the Project's private property hashtable.
Developed for use with Antelope, migrated to ant-contrib Oct 2003.
- Dale Anson, danson@germane-software.com
protected void | addProperties(Properties props) - iterate through a set of properties, resolve them, then assign them
|
void | execute() - Execute this task.
|
void | setFile(File file) - Set the name of a file to read properties from.
|
void | setName(String name) - Set the name of the property.
|
void | setUnset(boolean b) - Determines whether the property should be removed from the project.
|
void | setValue(String value) - Set the value of the property.
|
addProperties
protected void addProperties(Properties props)
iterate through a set of properties, resolve them, then assign them
props
- The feature to be added to the Properties attribute
execute
public void execute()
throws BuildException
Execute this task.
setFile
public void setFile(File file)
Set the name of a file to read properties from. Optional.
file
- the file to read properties from.
setName
public void setName(String name)
Set the name of the property. Required unless 'file' is used.
name
- the name of the property.
setUnset
public void setUnset(boolean b)
Determines whether the property should be removed from the project.
Default is false. Once removed, conditions that check for property
existence will find this property does not exist.
b
- set to true to remove the property from the project.
setValue
public void setValue(String value)
Set the value of the property. Optional, defaults to "".
value
- the value of the property.