Package dev.sigstore.strings
Interface StringMatcher
-
- All Superinterfaces:
java.util.function.Predicate<java.lang.String>
public interface StringMatcher extends java.util.function.Predicate<java.lang.String>An interface for allowing direct string matching or regular expressions. Use the static factorystring(String)orregex(String)to instantiate the appropriate matcher. Custom implementations should overrideObject.toString()for better error reporting.
-
-
Method Summary
Static Methods Modifier and Type Method Description static StringMatcherregex(java.lang.String string)Create a matcher using regular expressions.static StringMatcherstring(java.lang.String string)Create a matcher for string equality.
-
-
-
Method Detail
-
string
static StringMatcher string(java.lang.String string)
Create a matcher for string equality.
-
regex
static StringMatcher regex(java.lang.String string) throws RegexSyntaxException
Create a matcher using regular expressions. Regex matching ignores null values and returns false instead of erroring.- Parameters:
string- the input pattern- Returns:
- a regex based instance
- Throws:
RegexSyntaxException- if the input pattern is not valid regex. This is a runtime exception and probably should be handled
-
-