Class AnyOf<T>

Type Parameters:
T - the type of object this condition accepts.
All Implemented Interfaces:
Descriptable<Condition<T>>

public class AnyOf<T> extends Join<T>
Returns true if any of the joined conditions is satisfied.
Author:
Yvonne Wang, Mikhail Mazursky
  • Method Details

    • anyOf

      @SafeVarargs public static <T> Condition<T> anyOf(Condition<? super T>... conditions)
      Creates a new AnyOf
      Type Parameters:
      T - the type of object the given condition accept.
      Parameters:
      conditions - the conditions to evaluate.
      Returns:
      the created AnyOf.
      Throws:
      NullPointerException - if the given array is null.
      NullPointerException - if any of the elements in the given array is null.
    • anyOf

      public static <T> Condition<T> anyOf(Iterable<? extends Condition<? super T>> conditions)
      Creates a new AnyOf
      Type Parameters:
      T - the type of object the given condition accept.
      Parameters:
      conditions - the conditions to evaluate.
      Returns:
      the created AnyOf.
      Throws:
      NullPointerException - if the given iterable is null.
      NullPointerException - if any of the elements in the given iterable is null.
    • matches

      public boolean matches(T value)
      Verifies that the given value satisfies this condition.
      Overrides:
      matches in class Condition<T>
      Parameters:
      value - the value to verify.
      Returns:
      true if the given value satisfies this condition; false otherwise.
    • descriptionPrefix

      public String descriptionPrefix()
      Description copied from class: Join
      method used to prefix the subclass join description, ex: "all of"
      Specified by:
      descriptionPrefix in class Join<T>
      Returns:
      the prefix to use to build the description.