Class Result.Catcher<E extends java.lang.Throwable>

  • Enclosing class:
    Result<T,​I>

    public static class Result.Catcher<E extends java.lang.Throwable>
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> Result<T,​E> run​(Result.ThrowingSupplier<T,​E> supplier)
      Runs the provided ThrowingSupplier, gets its result and build a Result out of it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • run

        public <T> Result<T,​E> run​(Result.ThrowingSupplier<T,​E> supplier)
        Runs the provided ThrowingSupplier, gets its result and build a Result out of it. If there is a throw exception, and it is expected, it is catch and used as an issue to build the result.
        Type Parameters:
        T - The type of the content.
        Parameters:
        supplier - ThrowingSupplier providing a content. Should not provide null.
        Returns:
        Result either containing the supplied content or the catch exception as an issue.