Package org.apache.tools.ant.util
Class GlobPatternMapper
- java.lang.Object
- 
- org.apache.tools.ant.util.GlobPatternMapper
 
- 
- All Implemented Interfaces:
- FileNameMapper
 - Direct Known Subclasses:
- PackageNameMapper,- UnPackageNameMapper
 
 public class GlobPatternMapper extends java.lang.Object implements FileNameMapper Implementation of FileNameMapper that does simple wildcard pattern replacements.This does simple translations like *.foo -> *.bar where the prefix to .foo will be left unchanged. It only handles a single * character, use regular expressions for more complicated situations. This is one of the more useful Mappers, it is used by javac for example. 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.StringfromPostfixPart of "from" pattern after the *.protected java.lang.StringfromPrefixPart of "from" pattern before the *.protected intpostfixLengthLength of the postfix ("from" pattern).protected intprefixLengthLength of the prefix ("from" pattern).protected java.lang.StringtoPostfixPart of "to" pattern after the *.protected java.lang.StringtoPrefixPart of "to" pattern before the *.
 - 
Constructor SummaryConstructors Constructor Description GlobPatternMapper()
 - 
Method SummaryModifier and Type Method Description protected java.lang.StringextractVariablePart(java.lang.String name)Returns the part of the given string that matches the * in the "from" pattern.booleangetHandleDirSep()Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).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.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- 
fromPrefixprotected java.lang.String fromPrefix Part of "from" pattern before the *.
 - 
fromPostfixprotected java.lang.String fromPostfix Part of "from" pattern after the *.
 - 
prefixLengthprotected int prefixLength Length of the prefix ("from" pattern).
 - 
postfixLengthprotected int postfixLength Length of the postfix ("from" pattern).
 - 
toPrefixprotected java.lang.String toPrefix Part of "to" pattern before the *.
 - 
toPostfixprotected java.lang.String toPostfix Part of "to" pattern after the *.
 
- 
 - 
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
 
 - 
getHandleDirSeppublic boolean getHandleDirSep() Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).- Returns:
- boolean
- Since:
- Ant 1.8.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) Sets the "from" pattern. Required.- Specified by:
- setFromin interface- FileNameMapper
- Parameters:
- from- a string
 
 - 
setTopublic void setTo(java.lang.String to) Sets the "to" pattern. Required.- Specified by:
- setToin interface- FileNameMapper
- Parameters:
- to- a string
 
 - 
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 filename to map
- Returns:
- a list of converted filenames
 
 - 
extractVariablePartprotected java.lang.String extractVariablePart(java.lang.String name) Returns the part of the given string that matches the * in the "from" pattern.- Parameters:
- name- the source file name
- Returns:
- the variable part of the name
 
 
- 
 
-