Package org.instancio

Class When

java.lang.Object
org.instancio.When

@ExperimentalApi public final class When extends Object
Provides convenience methods for creating Predicates.
Since:
3.0.0
  • Method Details

    • is

      @ExperimentalApi public static <T> Predicate<T> is(T value)
      A predicate that returns true if values are equal using Objects.equals(Object, Object).
      Type Parameters:
      T - value type
      Parameters:
      value - to compare with
      Returns:
      predicate that checks that values are equal
      Since:
      3.0.0
    • isNot

      @ExperimentalApi public static <T> Predicate<T> isNot(T value)
      A predicate that returns true if values are not equal using Objects.equals(Object, Object).
      Type Parameters:
      T - value type
      Parameters:
      value - to compare with
      Returns:
      predicate that checks that values are not equal
      Since:
      3.0.0
    • isNull

      @ExperimentalApi public static <T> Predicate<T> isNull()
      A predicate that checks if a value is null.
      Type Parameters:
      T - value type
      Returns:
      predicate that checks if a value is null
      Since:
      3.0.0
    • isNotNull

      @ExperimentalApi public static <T> Predicate<T> isNotNull()
      A predicate that checks if a value is not null.
      Type Parameters:
      T - value type
      Returns:
      predicate that checks if a value is not null
      Since:
      3.0.0
    • isIn

      @SafeVarargs @ExperimentalApi public static <T> Predicate<T> isIn(T... values)
      A predicate that checks whether a value is equal to any element in the values array using Objects.equals(Object, Object).
      Type Parameters:
      T - value type
      Parameters:
      values - to compare with
      Returns:
      predicate that checks if a value is equal to any element of the input array
      Since:
      3.0.0