Class ConsumerUtils

java.lang.Object
org.apache.juneau.internal.ConsumerUtils

public final class ConsumerUtils extends Object
Utilities when working with Predicates and Consumers.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> void
    consume(Class<T> type, Predicate<T> predicate, Consumer<T> consumer, Object value)
    Consumes the specified value if it's the specified type and the predicate is null or matches the specified value.
    static <T> void
    consume(Predicate<T> predicate, Consumer<T> consumer, T value)
    Consumes the specified value if the predicate is null or matches the specified value.
    static <T> boolean
    test(Class<T> type, Predicate<T> predicate, Object value)
    Returns true if the specified object is the specified type and the specified predicate is null or matches the specified value.
    static <T> boolean
    test(Predicate<T> predicate, T value)
    Returns true if the specified predicate is null or matches the specified value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • test

      public static <T> boolean test(Predicate<T> predicate, T value)
      Returns true if the specified predicate is null or matches the specified value.
      Type Parameters:
      T - The type being tested.
      Parameters:
      predicate - The predicate.
      value - The value to test.
      Returns:
      true if the specified predicate is null or matches the specified value.
    • test

      public static <T> boolean test(Class<T> type, Predicate<T> predicate, Object value)
      Returns true if the specified object is the specified type and the specified predicate is null or matches the specified value.
      Type Parameters:
      T - The type being tested.
      Parameters:
      type - The expected type.
      predicate - The predicate.
      value - The value.
      Returns:
      true if the specified predicate is null or matches the specified value.
    • consume

      public static <T> void consume(Predicate<T> predicate, Consumer<T> consumer, T value)
      Consumes the specified value if the predicate is null or matches the specified value.
      Type Parameters:
      T - The type being consumed.
      Parameters:
      predicate - The predicate.
      consumer - The consumer.
      value - The value.
    • consume

      public static <T> void consume(Class<T> type, Predicate<T> predicate, Consumer<T> consumer, Object value)
      Consumes the specified value if it's the specified type and the predicate is null or matches the specified value.
      Type Parameters:
      T - The type being consumed.
      Parameters:
      type - The expected type.
      predicate - The predicate.
      consumer - The consumer.
      value - The value.