org.apache.tools.ant.util
Class RegexpPatternMapper
java.lang.Object
|
+--org.apache.tools.ant.util.RegexpPatternMapper
- All Implemented Interfaces:
- FileNameMapper
- public class RegexpPatternMapper
- extends java.lang.Object
- implements FileNameMapper
Implementation of FileNameMapper that does regular expression
replacements.
Method Summary |
java.lang.String[] |
mapFileName(java.lang.String sourceFileName)
Returns null if the source file name doesn't match the
"from" pattern, an one-element array containing the
translated file otherwise. |
protected java.lang.String |
replaceReferences(java.lang.String source)
Replace all backreferences in the to pattern with the matched
groups of the source. |
void |
setFrom(java.lang.String from)
Sets the "from" pattern. |
void |
setTo(java.lang.String to)
Sets the "to" pattern. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
reg
protected RegexpMatcher reg
to
protected char[] to
result
protected java.lang.StringBuffer result
RegexpPatternMapper
public RegexpPatternMapper()
throws BuildException
setFrom
public void setFrom(java.lang.String from)
throws BuildException
- Sets the "from" pattern. Required.
- Specified by:
setFrom
in interface FileNameMapper
setTo
public void setTo(java.lang.String to)
- Sets the "to" pattern. Required.
- Specified by:
setTo
in interface FileNameMapper
mapFileName
public java.lang.String[] mapFileName(java.lang.String sourceFileName)
- Returns null if the source file name doesn't match the
"from" pattern, an one-element array containing the
translated file otherwise.
- Specified by:
mapFileName
in interface FileNameMapper
- Following copied from interface:
org.apache.tools.ant.util.FileNameMapper
- Parameters:
sourceFileName
- the name of the source file relative to
some given basedirectory.
replaceReferences
protected java.lang.String replaceReferences(java.lang.String source)
- Replace all backreferences in the to pattern with the matched
groups of the source.
Includes only those classes commonly used by task writers. The Ant 1.4.1 distribution includes complete Javadoc for all classes included in Ant, though in most cases these are not intended as APIs.