|
RSE Release 3.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.rse.services.clientserver.FileTypeMatcher
public class FileTypeMatcher
This class offers file type matching. A file type is the extension part of a file name, minus the dot. For example, "java" and "class" are types.
Recently added is support for full file names, such as "manifest.mf", and even extension-less names which use the placeholder ".null" for the extension, as in "makefile.null" so as to dis-ambiguate from extensions like "cpp".
This supports being given a list of file types, via the constructor, to match on. It
will return true from the matches(String)
method if the given file name ends
in an extension that matches one of the given types.
By default, all matching is done case-insensitive, but this can be overridden in the
constructor or by calling setCaseSensitive(boolean)
.
For file name matching, use NamePatternMatcher
instead.
Field Summary | |
---|---|
static char |
SEP_EXTENSION
The delimiter that starts the extension part |
Constructor Summary | |
---|---|
FileTypeMatcher(String[] types)
Constructor for case-insensitive matching |
|
FileTypeMatcher(String[] types,
boolean caseSensitive)
Constructor when specifying if matching is case-sensitive or not |
Method Summary | |
---|---|
String[] |
getNames()
Return the names used to match on. |
String[] |
getTypes()
Return the types used to match on. |
boolean |
isCaseSensitive()
Return whether case should be considered when matching |
boolean |
matches(String fileName)
Test if a host name matches the pattern of this generic name. |
static String[] |
parseNames(String typeList)
Parse a comma-separated list of strings into an array of full-names. |
static String[] |
parseTypes(String typeList)
Parse a comma-separated list of strings into an array of strings representing extensions. |
void |
setCaseSensitive(boolean caseSensitive)
Set whether case should be considered when matching |
void |
setTypes(String[] types)
Reset the types used to match on |
void |
setTypesAndNames(String[] typesAndNames)
Reset the types and names used to match on |
void |
setTypesAndNames(String[] types,
String[] names)
Reset the types and names used to match on |
String |
toString()
For writing this object out. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char SEP_EXTENSION
Constructor Detail |
---|
public FileTypeMatcher(String[] types)
types
- Array of file types to match on. These should not include the dot. Eg, "java"public FileTypeMatcher(String[] types, boolean caseSensitive)
types
- Array of file types to match on. These should not include the dot. Eg, "java"caseSensitive
- true if to consider case when matchingMethod Detail |
---|
public void setTypes(String[] types)
public void setTypesAndNames(String[] types, String[] names)
public void setTypesAndNames(String[] typesAndNames)
public String[] getTypes()
toString()
public String[] getNames()
toString()
public void setCaseSensitive(boolean caseSensitive)
public boolean isCaseSensitive()
public boolean matches(String fileName)
matches
in interface IMatcher
fileName
- file name such as MyClass.java
setCaseSensitive(boolean)
public String toString()
toString
in class Object
public static String[] parseTypes(String typeList)
public static String[] parseNames(String typeList)
|
RSE Release 3.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |