Package org.apache.tools.ant.util
Class RegexpPatternMapper
java.lang.Object
org.apache.tools.ant.util.RegexpPatternMapper
- All Implemented Interfaces:
FileNameMapper
Implementation of FileNameMapper that does regular expression
replacements.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionString[]
mapFileName
(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 String
replaceReferences
(String source) Replace all backreferences in the to pattern with the matched groups of the source.void
setCaseSensitive
(boolean caseSensitive) Attribute specifying whether to ignore the case difference in the names.void
Sets the "from" pattern.void
setHandleDirSep
(boolean handleDirSep) Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).void
Sets the "to" pattern.
-
Field Details
-
reg
-
to
protected char[] to -
result
-
-
Constructor Details
-
RegexpPatternMapper
Constructor for RegexpPatternMapper.- Throws:
BuildException
- on error.
-
-
Method Details
-
setHandleDirSep
public void setHandleDirSep(boolean handleDirSep) Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).- Parameters:
handleDirSep
- a boolean, default is false.- Since:
- Ant 1.6.3
-
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive) Attribute specifying whether to ignore the case difference in the names.- Parameters:
caseSensitive
- a boolean, default is false.- Since:
- Ant 1.6.3
-
setFrom
Sets the "from" pattern. Required.- Specified by:
setFrom
in interfaceFileNameMapper
- Parameters:
from
- the from pattern.- Throws:
BuildException
- on error.
-
setTo
Sets the "to" pattern. Required.- Specified by:
setTo
in interfaceFileNameMapper
- Parameters:
to
- the to pattern.- Throws:
BuildException
- on error.
-
mapFileName
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 interfaceFileNameMapper
- Parameters:
sourceFileName
- the source file name- Returns:
- a one-element array containing the translated file or null if the to pattern did not match
-
replaceReferences
-