org.apache.tools.ant.taskdefs
public class Replace extends MatchingTask
<replacetoken> element.
Since: Ant 1.1
UNKNOWN: category="filesystem"
| Nested Class Summary | |
|---|---|
| class | Replace.NestedString
An inline string to use as the replacement text. |
| class | Replace.Replacefilter
A filter to apply. |
| Method Summary | |
|---|---|
| Replace.Replacefilter | createReplacefilter()
Add a nested <replacefilter> element. |
| Replace.NestedString | createReplaceToken()
Create a token to filter as the text of a nested element. |
| Replace.NestedString | createReplaceValue()
Create a string to replace the token as the text of a nested element. |
| void | execute()
Do the execution. |
| Properties | getProperties(File propertyFile)
Load a properties file. |
| void | setDir(File dir)
The base directory to use when replacing a token in multiple files;
required if file is not defined. |
| void | setEncoding(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(File file)
Set the source file; required unless dir is set. |
| void | setPropertyFile(File propertyFile)
The name of a property file from which properties specified using nested
<replacefilter> elements are drawn; required only if
the property attribute of <replacefilter> is used. |
| void | setReplaceFilterFile(File replaceFilterFile)
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(String token)
Set the string token to replace; required unless a nested
replacetoken element or the replacefilterfile
attribute is used. |
| void | setValue(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.
|
Returns: a nested Replacefilter object to be configured.
Returns: nested token NestedString to configure.
Returns: replacement value NestedString to configure.
Throws: BuildException if we cant build
Parameters: propertyFile the file to load the properties from.
Returns: loaded Properties object.
Throws: BuildException if the file could not be found or read.
file is not defined.Parameters: dir File representing the base directory.
Parameters: encoding the encoding to use on the files.
dir is set.Parameters: file source File.
<replacefilter> elements are drawn; required only if
the property attribute of <replacefilter> is used.Parameters: propertyFile File to load.
Parameters: replaceFilterFile File to load.
false.
Parameters: summary boolean whether a summary of the
replace operation should be logged.
replacetoken element or the replacefilterfile
attribute is used.Parameters: token token String.
Parameters: value replacement value.
Throws: BuildException if any supplied attribute is invalid or any mandatory attribute is missing.
Throws: BuildException if any supplied attribute is invalid or any mandatory attribute is missing.