|
Replace (Apache Ant API)
org.apache.tools.ant.taskdefs
|
Nested Class Summary | |
class |
Replace.NestedString
an inline string to use as the replacement text |
class |
Replace.Replacefilter
A filter to apply. |
Field Summary |
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
fileset, useDefaultExcludes |
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 file is 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 dir is 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 replacetoken element or the replacefilterfile
attribute 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()
|
void |
validateReplacefilters()
Validate nested elements. |
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
addAnd, addContains, addCustom, addDate, addDepend, addDepth, addFilename, addMajority, addNone, addNot, addOr, addPresent, addSelector, addSize, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, 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, handleErrorOutput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
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
BuildException
- if we cant buildpublic void validateAttributes() throws BuildException
BuildException
- if any supplied attribute is invalid or any
mandatory attribute is missingpublic void validateReplacefilters() throws BuildException
BuildException
- if any supplied attribute is invalid or any
mandatory attribute is missingpublic java.util.Properties getProperties(java.io.File propertyFile) throws BuildException
propertyFile
-
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 |