Top Description Constructors Methods
org.springframework.util

public abstract Class PatternMatchUtils

extends Object
Class Inheritance
Imports
org.springframework.lang.Nullable

Utility methods for simple pattern matching, in particular for Spring's typical xxx*, *xxx, *xxx*, and xxx*yyy pattern styles.
Author
Juergen Hoeller
Since
2.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

whether the String matches the given pattern
simpleMatch
(String
the pattern to match against
pattern
,
String
the String to match
str
)

Match a String against the given pattern, supporting direct equality as well as the following simple pattern styles: xxx*, *xxx, *xxx*, and xxx*yyy (with an arbitrary number of pattern parts).

public static boolean

Returns:

whether the String matches any of the given patterns
simpleMatch
(String[]
the patterns to match against
patterns
,
String
the String to match
str
)

Match a String against the given patterns, supporting direct equality as well as the following simple pattern styles: xxx*, *xxx, *xxx*, and xxx*yyy (with an arbitrary number of pattern parts).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PatternMatchUtilsback to summary
public PatternMatchUtils()

Method Detail

simpleMatchback to summary
public static boolean simpleMatch(String pattern, String str)

Match a String against the given pattern, supporting direct equality as well as the following simple pattern styles: xxx*, *xxx, *xxx*, and xxx*yyy (with an arbitrary number of pattern parts).

Returns false if the supplied String or pattern is null.

Parameters
pattern:String

the pattern to match against

str:String

the String to match

Returns:boolean

whether the String matches the given pattern

simpleMatchback to summary
public static boolean simpleMatch(String[] patterns, String str)

Match a String against the given patterns, supporting direct equality as well as the following simple pattern styles: xxx*, *xxx, *xxx*, and xxx*yyy (with an arbitrary number of pattern parts).

Returns false if the supplied String is null or if the supplied patterns array is null or empty.

Parameters
patterns:String[]

the patterns to match against

str:String

the String to match

Returns:boolean

whether the String matches any of the given patterns