| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.MatchingTask
                    |
                    +--org.apache.tools.ant.taskdefs.Replace
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.
 If you want to replace a text that crosses line boundaries, you
 must use a nested <replacetoken> element.
| Nested Class Summary | |
|  class | Replace.NestedStringan inline string to use as the replacement text | 
|  class | Replace.ReplacefilterA filter to apply. | 
| Field Summary | 
| Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask | 
| fileset | 
| 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 | |
| Replace() | |
| Method Summary | |
|  Replace.Replacefilter | createReplacefilter()Add a nested <replacefilter> element. | 
|  Replace.NestedString | createReplaceToken()the token to filter as the text of a nested element | 
|  Replace.NestedString | createReplaceValue()the string to replace the token as the text of a nested element | 
|  void | execute()Do the execution. | 
|  java.util.Properties | getProperties(java.io.File propertyFile)helper method to load a properties file and throw a build exception if it cannot be loaded | 
|  void | setDir(java.io.File dir)The base directory to use when replacing a token in multiple files; required if fileis not defined. | 
|  void | setEncoding(java.lang.String encoding)Set the file encoding to use on the files read and written by the task; optional, defaults to default JVM encoding | 
|  void | setFile(java.io.File file)Set the source file; required unless diris set. | 
|  void | setPropertyFile(java.io.File filename)The name of a property file from which properties specified using nested <replacefilter>elements are drawn;
 Required only if property attribute of<replacefilter>is used. | 
|  void | setReplaceFilterFile(java.io.File filename)Sets the name of a property file containing filters; optional. | 
|  void | setSummary(boolean summary)Indicates whether a summary of the replace operation should be produced, detailing how many token occurrences and files were processed; optional, default=false | 
|  void | setToken(java.lang.String token)Set the string token to replace; required unless a nested replacetokenelement or thereplacefilterfileattribute is used. | 
|  void | setValue(java.lang.String value)Set the string value to use as token replacement; optional, default is the empty string "" | 
|  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 | 
| add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems | 
| Methods inherited from class org.apache.tools.ant.Task | 
| getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType | 
| Methods inherited from class org.apache.tools.ant.ProjectComponent | 
| getProject | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public Replace()
| Method Detail | 
public void execute()
             throws BuildException
execute in class TaskBuildException - if we cant build
public void validateAttributes()
                        throws BuildException
BuildException - if any supplied attribute is invalid or any
 mandatory attribute is missing
public void validateReplacefilters()
                            throws BuildException
BuildException - if any supplied attribute is invalid or any
 mandatory attribute is missing
public java.util.Properties getProperties(java.io.File propertyFile)
                                   throws BuildException
propertyFile - the file to load the properties from
BuildException - if the file could not be found or readpublic void setFile(java.io.File file)
dir is set.
file - source filepublic void setSummary(boolean summary)
summary - true if you would like a summary logged of the
 replace operationpublic void setReplaceFilterFile(java.io.File filename)
filename - file to loadpublic void setDir(java.io.File dir)
file is not defined.
dir - base dirpublic void setToken(java.lang.String token)
replacetoken element or the replacefilterfile
 attribute is used.
token - token stringpublic void setValue(java.lang.String value)
value - replacement valuepublic void setEncoding(java.lang.String encoding)
encoding - the encoding to use on the filespublic Replace.NestedString createReplaceToken()
public Replace.NestedString createReplaceValue()
public void setPropertyFile(java.io.File filename)
<replacefilter> elements are drawn;
 Required only if property attribute of
 <replacefilter> is used.
filename - file to loadpublic Replace.Replacefilter createReplacefilter()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||