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()
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. |
| Properties | getProperties(File propertyFile)
helper method to load a properties file and throw a build exception
if it cannot be loaded |
| 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 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(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(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 to configure
Returns: replacement value to configure
Throws: BuildException if we cant build
Parameters: propertyFile the file to load the properties from
Returns: loaded properties collection
Throws: BuildException if the file could not be found or read
file is not defined.Parameters: dir base dir
Parameters: encoding the encoding to use on the files
dir is set.Parameters: file source file
<replacefilter> elements are drawn;
Required only if property attribute of
<replacefilter> is used.Parameters: filename file to load
Parameters: filename file to load
Parameters: summary true if you would like a summary logged of the replace operation
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