Top Description Constructors Methods
org.apache.tomcat.jakartaee

public final Class GlobMatcher

extends Object
Class Inheritance
Imports
java.util.Set

This is a utility class to match file globs. The class has been derived from org.apache.tools.ant.types.selectors.SelectorUtils.

All methods are static.

Constructor Summary

AccessConstructor and Description
public
GlobMatcher()

Construct the matcher.

Method Summary

Modifier and TypeMethod and Description
private static boolean
allStars(char[] chars, int start, int end)

private static boolean
different(boolean caseSensitive, char ch, char other)

public static boolean

Returns:

true if the string matches against the pattern, or false otherwise.
match
(String
The pattern to match against. Must not be null.
pattern
,
String
The string which must be matched against the pattern. Must not be null.
str
,
boolean
Whether or not matching should be performed case sensitively.
caseSensitive
)

Tests whether or not a string matches against a pattern.

private static boolean

Returns:

true if the string matches against the pattern, or false otherwise.
match
(String
The pattern to match against. Must not be null.
pattern
,
char[]
The character array which must be matched against the pattern. Must not be null.
strArr
,
boolean
Whether or not matching should be performed case sensitively.
caseSensitive
)

Tests whether or not a string matches against a pattern.

public static boolean

Returns:

true if any pattern in the set matches against the file name, or false otherwise.
matchName
(Set<String>
The pattern set to match against. Must not be null.
patternSet
,
String
The file name to match, as a String. Must not be null. It must be just a file name, without a path.
fileName
,
boolean
Whether or not matching should be performed case sensitively.
caseSensitive
)

Tests whether or not a given file name matches any file name pattern in the given set.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

GlobMatcherback to summary
public GlobMatcher()

Construct the matcher.

Method Detail

allStarsback to summary
private static boolean allStars(char[] chars, int start, int end)
differentback to summary
private static boolean different(boolean caseSensitive, char ch, char other)
matchback to summary
public static boolean match(String pattern, String str, boolean caseSensitive)

Tests whether or not a string matches against a pattern. The pattern may contain two special characters:
'*' means zero or more characters
'?' means one and only one character

Parameters
pattern:String

The pattern to match against. Must not be null.

str:String

The string which must be matched against the pattern. Must not be null.

caseSensitive:boolean

Whether or not matching should be performed case sensitively.

Returns:boolean

true if the string matches against the pattern, or false otherwise.

matchback to summary
private static boolean match(String pattern, char[] strArr, boolean caseSensitive)

Tests whether or not a string matches against a pattern. The pattern may contain two special characters:
'*' means zero or more characters
'?' means one and only one character

Parameters
pattern:String

The pattern to match against. Must not be null.

strArr:char[]

The character array which must be matched against the pattern. Must not be null.

caseSensitive:boolean

Whether or not matching should be performed case sensitively.

Returns:boolean

true if the string matches against the pattern, or false otherwise.

matchNameback to summary
public static boolean matchName(Set<String> patternSet, String fileName, boolean caseSensitive)

Tests whether or not a given file name matches any file name pattern in the given set. The match is performed case-sensitively.

Parameters
patternSet:Set<String>

The pattern set to match against. Must not be null.

fileName:String

The file name to match, as a String. Must not be null. It must be just a file name, without a path.

caseSensitive:boolean

Whether or not matching should be performed case sensitively.

Returns:boolean

true if any pattern in the set matches against the file name, or false otherwise.

See Also
match(String, String, boolean)