Class GlobPatternMapper
java.lang.Object
org.apache.maven.shared.model.fileset.mappers.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.mapFileName
(String sourceFileName) Returns the target filename for the given source file.void
setCaseSensitive
(boolean caseSensitive) Attribute specifing whether to ignore the case difference in the names.void
Sets the from part of the transformation rule.void
setHandleDirSep
(boolean handleDirSep) Attribute specifing whether to ignore the difference between / and \ (the two common directory characters).void
Sets the to part of the transformation rule.
-
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 specifing whether to ignore the difference between / and \ (the two common directory characters).- Parameters:
handleDirSep
- a boolean, default is false.
-
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive) Attribute specifing whether to ignore the case difference in the names.- Parameters:
caseSensitive
- a boolean, default is false.
-
setFrom
Description copied from interface:FileNameMapper
Sets the from part of the transformation rule.- Specified by:
setFrom
in interfaceFileNameMapper
- Parameters:
from
- the source
-
setTo
Description copied from interface:FileNameMapper
Sets the to part of the transformation rule.- Specified by:
setTo
in interfaceFileNameMapper
- Parameters:
to
- the destination
-
mapFileName
Description copied from interface:FileNameMapper
Returns the target filename for the given source file.If the given rule doesn't apply to the source file, the implementation must return null. SourceFileScanner will then omit the source file in question.
- Specified by:
mapFileName
in interfaceFileNameMapper
- Parameters:
sourceFileName
- the name of the source file relative to some given base directory- Returns:
- the target filename for the given source file
-
extractVariablePart
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
-