Matcher

public interface Matcher<T>(source)

A matcher is a function mapping objects to positive/negative matches.

Parameters

<T>

the type of object to match

Functions

Link copied to clipboard
public static Matcher<T> always<T>()
Returns an always positive-matching matcher.
Link copied to clipboard
public Matcher<T> and(Matcher<? super T> other)
Returns a new matcher that logically combines the current matcher with the given matcher using the logical and operator.
Link copied to clipboard
The characteristic of this matcher.
Link copied to clipboard
public Matcher<U> map<U>(Function<U, T> mapper)
Returns a new matcher that maps the given mapper before matching with this matcher.
Link copied to clipboard
public abstract Match<ST> match<ST extends T>(ST object)
Returns a match for the given object.
Link copied to clipboard
public Matcher<T> negate()
returns a Matcher that matches the logical negation of this matcher.
Link copied to clipboard
public static Matcher<T> never<T>()
Returns an always negative-matching matcher.
Link copied to clipboard
public static Matcher<T> of<T>(Predicate<T> matcher)

public static Matcher<T> of<T>(Predicate<T> matcher, Object object)
public static Matcher<T> of<T>(Predicate<T> matcher, String characteristic)
Creates a Matcher with the given Characteristic
Link copied to clipboard
public Matcher<T> or(Matcher<T> other)
Returns a new matcher that logically combines the current matcher with the given matcher using the logical or operator.
Link copied to clipboard
public Predicate<U> predicate<U extends T>()
returns a Predicate that returns true if the given object is matched by this matcher.