Methods Summary |
---|
protected java.lang.String | extractVariablePart(java.lang.String name)Returns the part of the given string that matches the * in the
"from" pattern.
return name.substring(prefixLength,
name.length() - postfixLength);
|
public 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.
if (fromPrefix == null
|| !modifyName(sourceFileName).startsWith(modifyName(fromPrefix))
|| !modifyName(sourceFileName).endsWith(modifyName(fromPostfix))) {
return null;
}
return new String[] {toPrefix
+ extractVariablePart(sourceFileName)
+ toPostfix};
|
private java.lang.String | modifyName(java.lang.String name)modify string based on dir char mapping and case sensitivity
if (!caseSensitive) {
name = name.toLowerCase();
}
if (handleDirSep) {
if (name.indexOf('\\") != -1) {
name = name.replace('\\", '/");
}
}
return name;
|
public void | setCaseSensitive(boolean caseSensitive)Attribute specifing whether to ignore the case difference
in the names.
this.caseSensitive = caseSensitive;
|
public void | setFrom(java.lang.String from)Sets the "from" pattern. Required.
int index = from.lastIndexOf("*");
if (index == -1) {
fromPrefix = from;
fromPostfix = "";
} else {
fromPrefix = from.substring(0, index);
fromPostfix = from.substring(index + 1);
}
prefixLength = fromPrefix.length();
postfixLength = fromPostfix.length();
|
public void | setHandleDirSep(boolean handleDirSep)Attribute specifing whether to ignore the difference
between / and \ (the two common directory characters).
this.handleDirSep = handleDirSep;
|
public void | setTo(java.lang.String to)Sets the "to" pattern. Required.
int index = to.lastIndexOf("*");
if (index == -1) {
toPrefix = to;
toPostfix = "";
} else {
toPrefix = to.substring(0, index);
toPostfix = to.substring(index + 1);
}
|