public class GlobPatternMapper extends Object implements FileNameMapper
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.
Modifier and Type | Field and Description |
---|---|
protected String |
fromPostfix
Part of "from" pattern after the *.
|
protected String |
fromPrefix
Part of "from" pattern before the *.
|
protected int |
postfixLength
Length of the postfix ("from" pattern).
|
protected int |
prefixLength
Length of the prefix ("from" pattern).
|
protected String |
toPostfix
Part of "to" pattern after the *.
|
protected String |
toPrefix
Part of "to" pattern before the *.
|
Constructor and Description |
---|
GlobPatternMapper() |
Modifier and Type | Method and Description |
---|---|
protected String |
extractVariablePart(String name)
Returns the part of the given string that matches the * in the
"from" pattern.
|
boolean |
getHandleDirSep()
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 |
setFrom(String from)
Sets the "from" pattern.
|
void |
setHandleDirSep(boolean handleDirSep)
Attribute specifying whether to ignore the difference
between / and \ (the two common directory characters).
|
void |
setTo(String to)
Sets the "to" pattern.
|
protected String fromPostfix
protected String fromPrefix
protected int postfixLength
protected int prefixLength
protected String toPostfix
protected String toPrefix
protected String extractVariablePart(String name)
name
- the source file namepublic boolean getHandleDirSep()
public String[] mapFileName(String sourceFileName)
mapFileName
in interface FileNameMapper
sourceFileName
- the filename to mappublic void setCaseSensitive(boolean caseSensitive)
caseSensitive
- a boolean, default is false.public void setFrom(String from)
setFrom
in interface FileNameMapper
from
- a stringpublic void setHandleDirSep(boolean handleDirSep)
handleDirSep
- a boolean, default is false.public void setTo(String to)
setTo
in interface FileNameMapper
to
- a string