Variable (Ant Contrib)
Keywords: net.sf.antcontrib.property.Variable,Variable class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.antcontrib.property
Class Variable

    java.lang.Object
      |
      +--org.apache.tools.ant.ProjectComponent
            |
            +--org.apache.tools.ant.Task
                  |
                  +--net.sf.antcontrib.property.Variable

public class Variable
extends org.apache.tools.ant.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.

Since:
  Ant 1.5
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
`Variable()`

Method Summary
`protected void` | `addProperties(java.util.Properties props)` iterate through a set of properties, resolve them, then assign them
`void` | `execute()` Execute this task.
`void` | `setFile(java.io.File file)` Set the name of a file to read properties from.
`void` | `setName(java.lang.String name)` Set the name of the property.
`void` | `setValue(java.lang.String value)` Set the value of the property.

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, 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

### Variable

    public Variable()

Method Detail

### setName

    public void setName(java.lang.String name)

  Set the name of the property. Required unless 'file' is used.

  Parameters:
    `name` - the name of the property.

### setValue

    public void setValue(java.lang.String value)

  Set the value of the property. Optional, defaults to "".

  Parameters:
    `value` - the value of the property.

### setFile

    public void setFile(java.io.File file)

  Set the name of a file to read properties from. Optional.

  Parameters:
    `file` - the file to read properties from.

### execute

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

  Execute this task.

  Overrides:
    `execute` in class `org.apache.tools.ant.Task`
  Throws:
    `org.apache.tools.ant.BuildException` - Description of the Exception

### addProperties

    protected void addProperties(java.util.Properties props)

  iterate through a set of properties, resolve them, then assign them

  Parameters:
    `props` - The feature to be added to the Properties attribute

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD