Class FailSafe<Argument,​Result>

  • All Implemented Interfaces:
    org.dmfs.jems2.FragileFunction<Argument,​Result,​java.lang.RuntimeException>, org.dmfs.jems2.Function<Argument,​Result>, org.dmfs.jems2.ThrowingFunction<Argument,​Result>

    public final class FailSafe<Argument,​Result>
    extends java.lang.Object
    implements org.dmfs.jems2.Function<Argument,​Result>
    A ThrowingFunction to Function adapter that always returns a result, even in case a Throwable was thrown.
    • Constructor Summary

      Constructors 
      Constructor Description
      FailSafe​(org.dmfs.jems2.Function<java.lang.Throwable,​Result> fallback, org.dmfs.jems2.ThrowingFunction<Argument,​Result> delegate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Result value​(Argument argument)  
      • Methods inherited from class java.lang.Object

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

      • FailSafe

        public FailSafe​(org.dmfs.jems2.Function<java.lang.Throwable,​Result> fallback,
                        org.dmfs.jems2.ThrowingFunction<Argument,​Result> delegate)
    • Method Detail

      • value

        public Result value​(Argument argument)
        Specified by:
        value in interface org.dmfs.jems2.FragileFunction<Argument,​Result,​java.lang.RuntimeException>
        Specified by:
        value in interface org.dmfs.jems2.Function<Argument,​Result>
        Specified by:
        value in interface org.dmfs.jems2.ThrowingFunction<Argument,​Result>