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
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 Summary
Modifier and TypeFieldDescriptionprotected String
Part of "from" pattern after the *.protected String
Part of "from" pattern before the *.protected int
Length of the postfix ("from" pattern).protected int
Length of the prefix ("from" pattern).protected String
Part of "to" pattern after the *.protected String
Part of "to" pattern before the *. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
extractVariablePart
(String name) Returns the part of the given string that matches the * in the "from" pattern.boolean
Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).String[]
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.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
-
fromPrefix
Part of "from" pattern before the *. -
fromPostfix
Part of "from" pattern after the *. -
prefixLength
protected int prefixLengthLength of the prefix ("from" pattern). -
postfixLength
protected int postfixLengthLength of the postfix ("from" pattern). -
toPrefix
Part of "to" pattern before the *. -
toPostfix
Part of "to" pattern after the *.
-
-
Constructor Details
-
GlobPatternMapper
public GlobPatternMapper()
-
-
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
-
getHandleDirSep
public boolean getHandleDirSep()Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).- Returns:
- boolean
- Since:
- Ant 1.8.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
- a string
-
setTo
Sets the "to" pattern. Required.- Specified by:
setTo
in interfaceFileNameMapper
- Parameters:
to
- a string
-
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 filename to map- Returns:
- a list of converted filenames
-
extractVariablePart
-