Class PatternMatchUtils
java.lang.Object
org.springframework.integration.support.utils.PatternMatchUtils
Utility methods for pattern matching.
This utility provides support of negative pattern matching as well
unlike
PatternMatchUtils.- Since:
- 5.0
- Author:
- Meherzad Lahewala, Artem Bilan
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable BooleansmartMatch(@Nullable String str, String @Nullable ... patterns) Pattern match against the supplied patterns; also supports negated ('!') patterns.static @Nullable BooleansmartMatchIgnoreCase(@Nullable String str, String @Nullable ... patterns) Pattern match against the supplied patterns ignoring a case; also supports negated ('!') patterns.
-
Method Details
-
smartMatchIgnoreCase
@Contract("null, _ -> null; _, null -> null") public static @Nullable Boolean smartMatchIgnoreCase(@Nullable String str, String @Nullable ... patterns) Pattern match against the supplied patterns ignoring a case; also supports negated ('!') patterns. First match wins (positive or negative). To match the names starting with!symbol, you have to escape it prepending with the\symbol in the pattern definition.- Parameters:
str- the string to match.patterns- the patterns.- Returns:
- true for a positive match; false for a negative; null if no pattern matches.
- Since:
- 5.0.5
- See Also:
-
smartMatch
@Contract("_, null -> null") public static @Nullable Boolean smartMatch(@Nullable String str, String @Nullable ... patterns) Pattern match against the supplied patterns; also supports negated ('!') patterns. First match wins (positive or negative). To match the names starting with!symbol, you have to escape it prepending with the\symbol in the pattern definition.- Parameters:
str- the string to match.patterns- the patterns.- Returns:
- true for a positive match; false for a negative; null if no pattern matches.
- See Also:
-