Interface Supplier<T>

Type Parameters:
T - the supplied type
All Superinterfaces:
Supplier<T>
All Known Subinterfaces:
Context<T>, ContextualBatch, IdentifierFactory<I>
All Known Implementing Classes:
AbstractContext, AbstractContextualBatch, AffinityIdentifierFactory, DefaultTransactionalBatch, SimpleContextualBatch, SimpleContextualBatchFactory, SimpleIdentifierFactory, TransactionalBatchFactory

public interface Supplier<T> extends Supplier<T>
An enhanced supplier.
Author:
Paul Ferraro
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Supplier<?>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> Supplier<T>
    call(Callable<T> caller, Function<Exception,T> handler)
    Returns a supplier that delegates to the specified caller using the specified exception handler.
    static <T> Supplier<T>
    Returns a supplier that always returns the specified value.
    default Supplier<T>
    Returns a new supplier that delegates to this supplier using the specified exception handler.
    default <V> Supplier<V>
    map(Function<T,V> mapper)
    Returns a supplier that returns the value this function mapped via the specified function.
    static <T> Supplier<T>
    of(T value)
    Returns a supplier that always returns the specified value.
    static <T> Supplier<T>
    run(Runnable task)
    Returns a supplier that returns null after invoking the specified task.

    Methods inherited from interface java.util.function.Supplier

    get
  • Field Details

  • Method Details

    • map

      default <V> Supplier<V> map(Function<T,V> mapper)
      Returns a supplier that returns the value this function mapped via the specified function.
      Type Parameters:
      V - the mapped value type
      Parameters:
      mapper - a mapping function
      Returns:
      a supplier that returns the value this function mapped via the specified function.
    • handle

      default Supplier<T> handle(Function<RuntimeException,T> handler)
      Returns a new supplier that delegates to this supplier using the specified exception handler.
      Parameters:
      handler - an exception handler
      Returns:
      a new supplier that delegates to this supplier using the specified exception handler.
    • empty

      static <T> Supplier<T> empty()
      Returns a supplier that always returns the specified value.
      Type Parameters:
      T - the supplied type
      Parameters:
      value - the supplied value
      Returns:
      a supplier that always returns the specified value.
    • of

      static <T> Supplier<T> of(T value)
      Returns a supplier that always returns the specified value.
      Type Parameters:
      T - the supplied type
      Parameters:
      value - the supplied value
      Returns:
      a supplier that always returns the specified value.
    • run

      static <T> Supplier<T> run(Runnable task)
      Returns a supplier that returns null after invoking the specified task.
      Type Parameters:
      T - the supplied type
      Parameters:
      task - the task to run
      Returns:
      a supplier that returns null after invoking the specified task.
    • call

      static <T> Supplier<T> call(Callable<T> caller, Function<Exception,T> handler)
      Returns a supplier that delegates to the specified caller using the specified exception handler.
      Type Parameters:
      T - the supplied type
      Parameters:
      caller - the caller to call
      handler - an exception handler
      Returns:
      a supplier that delegates to the specified caller using the specified exception handler.