Interface Matcher<T>
- Type Parameters:
T- the type of object to match
public interface Matcher<T>
A matcher is a function mapping objects to positive/negative matches.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Matcher<T>always()Returns an always positive-matching matcher.Returns a new matcher that logically combines the current matcher with the given matcher using the logicalandoperator.match(ST object) Returns a match for the given object.negate()returns a Matcher that matches the logical negation of this matcher.static <T> Matcher<T>never()Returns an always negative-matching matcher.default Objectobject()static <T> Matcher<T>static <T> Matcher<T>Returns a new matcher that logically combines the current matcher with the given matcher using the logicaloroperator.returns aPredicatethat returnstrueif the given object is matched by this matcher.
-
Method Details
-
always
Returns an always positive-matching matcher.
- Type Parameters:
T- the type of object to match- Returns:
- the matcher
-
never
Returns an always negative-matching matcher.
- Type Parameters:
T- the type of object to match- Returns:
- the matcher
-
of
-
of
-
match
Returns a match for the given object.
- Type Parameters:
ST- the type of the object to match- Parameters:
object- the object- Returns:
- the match
-
object
-
predicate
returns a
Predicatethat returnstrueif the given object is matched by this matcher.- Type Parameters:
U- the type of the object to match- Returns:
- the predicate
-
negate
returns a Matcher that matches the logical negation of this matcher.
- Returns:
- the negated matcher
-
and
Returns a new matcher that logically combines the current matcher with the given matcher using the logical
andoperator.- Parameters:
other- the other matcher- Returns:
- the new matcher
-
or
Returns a new matcher that logically combines the current matcher with the given matcher using the logical
oroperator.- Parameters:
other- the other matcher- Returns:
- the new matcher
-