Interface Producer<T>

Type Parameters:
T - the type of value produced
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Producer<T>
A supplier of values that may throw a checked exception.

Unlike Supplier, this interface allows implementations to throw checked exceptions, making it suitable for token sources that perform I/O, call external services, or otherwise fail in checked ways (e.g. fetching an OAuth access token or reading a secret from a vault).

  • Method Summary

    Modifier and Type
    Method
    Description
    Produces a value.
  • Method Details

    • produce

      T produce() throws Exception
      Produces a value.
      Returns:
      the produced value
      Throws:
      Exception - if production fails