Package 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.
- 
- 
Field SummaryFields Modifier and Type Field Description protected RegexpMatcherregprotected java.lang.StringBufferresultprotected char[]to
 - 
Constructor SummaryConstructors Constructor Description RegexpPatternMapper()Constructor for RegexpPatternMapper.
 - 
Method SummaryModifier and Type Method Description 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.StringreplaceReferences(java.lang.String source)Replace all backreferences in the to pattern with the matched groups of the source.voidsetCaseSensitive(boolean caseSensitive)Attribute specifying whether to ignore the case difference in the names.voidsetFrom(java.lang.String from)Sets the "from" pattern.voidsetHandleDirSep(boolean handleDirSep)Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).voidsetTo(java.lang.String to)Sets the "to" pattern.
 
- 
- 
- 
Field Detail- 
regprotected RegexpMatcher reg 
 - 
toprotected char[] to 
 - 
resultprotected java.lang.StringBuffer result 
 
- 
 - 
Constructor Detail- 
RegexpPatternMapperpublic RegexpPatternMapper() throws BuildExceptionConstructor for RegexpPatternMapper.- Throws:
- BuildException- on error.
 
 
- 
 - 
Method Detail- 
setHandleDirSeppublic 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
 
 - 
setCaseSensitivepublic 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
 
 - 
setFrompublic void setFrom(java.lang.String from) throws BuildExceptionSets the "from" pattern. Required.- Specified by:
- setFromin interface- FileNameMapper
- Parameters:
- from- the from pattern.
- Throws:
- BuildException- on error.
 
 - 
setTopublic void setTo(java.lang.String to) Sets the "to" pattern. Required.- Specified by:
- setToin interface- FileNameMapper
- Parameters:
- to- the to pattern.
- Throws:
- BuildException- on error.
 
 - 
mapFileNamepublic 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:
- mapFileNamein interface- FileNameMapper
- Parameters:
- sourceFileName- the source file name
- Returns:
- a one-element array containing the translated file or null if the to pattern did not match
 
 - 
replaceReferencesprotected java.lang.String replaceReferences(java.lang.String source) Replace all backreferences in the to pattern with the matched groups of the source.- Parameters:
- source- the source file name.
- Returns:
- the translated file name.
 
 
- 
 
-