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 Type
    Method
    Description
    static <T> Matcher<T>
    Returns an always positive-matching matcher.
    default <U extends T>
    Matcher<U>
    and(Matcher<U> other)
     
    <ST extends T>
    Match<ST>
    match(ST object)
    Returns a match for the given object.
    static <T> Matcher<T>
    Returns an always negative-matching matcher.
    default Object
     
    static <T> Matcher<T>
    of(Predicate<T> matcher)
     
    static <T> Matcher<T>
    of(Predicate<T> matcher, Object object)
     
  • Method Details

    • always

      static <T> Matcher<T> always()

      Returns an always positive-matching matcher.

      Type Parameters:
      T - the type of object to match
      Returns:
      the matcher
    • never

      static <T> Matcher<T> never()

      Returns an always negative-matching matcher.

      Type Parameters:
      T - the type of object to match
      Returns:
      the matcher
    • of

      static <T> Matcher<T> of(Predicate<T> matcher, Object object)
    • of

      static <T> Matcher<T> of(Predicate<T> matcher)
    • match

      <ST extends T> Match<ST> match(ST object)

      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

      default Object object()
    • and

      default <U extends T> Matcher<U> and(Matcher<U> other)