org.apache.tools.ant.taskdefs.optional

Class PropertyFile

Implemented Interfaces:
Cloneable

public class PropertyFile
extends Task

Modifies settings in a property file.

The following is an example of its usage:

</target>

The <propertyfile> task must have:

Other parameters are:
The <entry> task must have:
Other parameters are:
If type is unspecified, it defaults to string Parameter values:
  • value:
  • String property types can only use the "=" operation. Int property types can only use the "=", "-" or "+" operations.

    The message property is used for the property file header, with "\\" being a newline delimiter character.

    Nested Class Summary

    static class
    PropertyFile.Entry
    Instance of this class represents nested elements of a task propertyfile.
    static class
    PropertyFile.Unit
    Borrowed from Tstamp

    Field Summary

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project

    Method Summary

    PropertyFile.Entry
    createEntry()
    The entry nested element.
    void
    execute()
    Execute the task.
    void
    setComment(String hdr)
    optional header comment for the file
    void
    setFile(File file)
    Location of the property file to be edited; required.

    Methods inherited from class org.apache.tools.ant.Task

    bindToOwner, execute, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject

    Method Details

    createEntry

    public PropertyFile.Entry createEntry()
    The entry nested element.
    Returns:
    an entry nested element to be configured.

    execute

    public void execute()
                throws BuildException
    Execute the task.
    Overrides:
    execute in interface Task
    Throws:
    BuildException - on error.

    setComment

    public void setComment(String hdr)
    optional header comment for the file
    Parameters:
    hdr - the string to use for the comment.

    setFile

    public void setFile(File file)
    Location of the property file to be edited; required.
    Parameters:
    file - the property file.