org.apache.tools.ant.taskdefs
Class Replace

java.lang.Object
  |
  +--org.apache.tools.ant.Task
        |
        +--org.apache.tools.ant.taskdefs.MatchingTask
              |
              +--org.apache.tools.ant.taskdefs.Replace

public class Replace
extends MatchingTask

Replaces all occurrences of one or more string tokens with given values in the indicated files. Each value can be either a string or the value of a property available in a designated property file.

Author:
Stefano Mazzocchi stefano@apache.org, Erik Langenbach

Inner Class Summary
 class Replace.NestedString
           
 class Replace.Replacefilter
           
 
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
fileset, useDefaultExcludes
 
Fields inherited from class org.apache.tools.ant.Task
description, location, project, target, taskName, taskType, wrapper
 
Constructor Summary
Replace()
           
 
Method Summary
 Replace.Replacefilter createReplacefilter()
          Add nested element.
 Replace.NestedString createReplaceToken()
          Nested element.
 Replace.NestedString createReplaceValue()
          Nested element.
 void execute()
          Do the execution.
 java.util.Properties getProperties(java.io.File propertyFile)
           
 void setDir(java.io.File dir)
          Set the source files path when using matching tasks.
 void setFile(java.io.File file)
          Set the source file.
 void setPropertyFile(java.lang.String filename)
          Sets a file to be searched for property values.
 void setToken(java.lang.String token)
          Set the string token to replace.
 void setValue(java.lang.String value)
          Set the string value to use as token replacement.
 void validateAttributes()
          Validate attributes provided for this task in .xml build file.
 void validateReplacefilters()
          Validate nested elements.
 
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
createExclude, createInclude, createPatternSet, getDirectoryScanner, setDefaultexcludes, setExcludes, setExcludesfile, setIncludes, setIncludesfile, XsetIgnore, XsetItems
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Replace

public Replace()
Method Detail

execute

public void execute()
             throws BuildException
Do the execution.
Overrides:
execute in class Task
Following copied from class: org.apache.tools.ant.Task
Throws:
BuildException - if someting goes wrong with the build

validateAttributes

public void validateAttributes()
                        throws BuildException
Validate attributes provided for this task in .xml build file.
Throws:
BuildException - if any supplied attribute is invalid or any mandatory attribute is missing

validateReplacefilters

public void validateReplacefilters()
                            throws BuildException
Validate nested elements.
Throws:
BuildException - if any supplied attribute is invalid or any mandatory attribute is missing

getProperties

public java.util.Properties getProperties(java.io.File propertyFile)
                                   throws BuildException

setFile

public void setFile(java.io.File file)
Set the source file.

setDir

public void setDir(java.io.File dir)
Set the source files path when using matching tasks.

setToken

public void setToken(java.lang.String token)
Set the string token to replace.

setValue

public void setValue(java.lang.String value)
Set the string value to use as token replacement.

createReplaceToken

public Replace.NestedString createReplaceToken()
Nested element.

createReplaceValue

public Replace.NestedString createReplaceValue()
Nested element.

setPropertyFile

public void setPropertyFile(java.lang.String filename)
Sets a file to be searched for property values.

createReplacefilter

public Replace.Replacefilter createReplacefilter()
Add nested element.


Copyright ? 2000 Apache Software Foundation. All Rights Reserved.