Class MaybeFromSupplier<T>

  • Type Parameters:
    T - the value type
    All Implemented Interfaces:
    MaybeSource<T>, Supplier<T>

    public final class MaybeFromSupplier<T>
    extends Maybe<T>
    implements Supplier<T>
    Executes a supplier and signals its value as success or signals an exception.
    Since:
    3.0.0
    • Field Detail

      • supplier

        final Supplier<? extends T> supplier
    • Constructor Detail

      • MaybeFromSupplier

        public MaybeFromSupplier​(Supplier<? extends T> supplier)
    • Method Detail

      • subscribeActual

        protected void subscribeActual​(MaybeObserver<? super T> observer)
        Description copied from class: Maybe
        Implement this method in subclasses to handle the incoming MaybeObservers.

        There is no need to call any of the plugin hooks on the current Maybe instance or the MaybeObserver; all hooks and basic safeguards have been applied by Maybe.subscribe(MaybeObserver) before this method gets called.

        Specified by:
        subscribeActual in class Maybe<T>
        Parameters:
        observer - the MaybeObserver to handle, not null
      • get

        public T get()
              throws java.lang.Throwable
        Description copied from interface: Supplier
        Produces a value or throws an exception.
        Specified by:
        get in interface Supplier<T>
        Returns:
        the value produced
        Throws:
        java.lang.Throwable - if the implementation wishes to throw any type of exception