Interface ObjectReturnExceptionHandlerSupport<F,L,S,T,Z extends ObjectReturnExceptionHandlerSupport<F,L,S,T,Z>>

    • Method Detail

      • lift

        L lift()
        Converts this functional interface to a lifted one. The lifted version return an Optional of the original return type.

        Conceptually, this is done by :

         (xxx) -> {
                try {
                        return Optional.ofNullable(realaction(xxx));
                } catch (Exception e) {
                        return Optional.empty();
                }
         }
         
        Specified by:
        lift in interface ExceptionHandlerSupport<F,L,S>
        Returns:
        the lifted function
        See Also:
        uncheck(), ignore()
      • ignore

        F ignore()
        Converts this functional interface to the corresponding java standard functional interface returning a null in case of error.

        The principle is :

         (xxx) -> {
                try {
                        return realaction(xxx);
                } catch (Exception e) {
                        return null;
                }
         }
         
        Specified by:
        ignore in interface ExceptionHandlerSupport<F,L,S>
        Returns:
        the operation that ignore error
        See Also:
        uncheck(), lift()
      • stage

        S stage()
        Converts this functional interface to the corresponding java standard functional interface with staged result.
        Returns:
        the operation supporting stage.
        Since:
        1.1.0
        See Also:
        CompletionStage
      • defaultValue

        default T defaultValue()
        Defines the default value (by default null) returned by the ignore and ignored method.
        Returns:
        the default value for the ignore/ignored method.
        Since:
        3.0.0
      • unchecked

        static <T> T unchecked​(Callable<T> internal,
                               Function<Exception,T> exceptionhandler)
        Used internally to support the exception interception.
        Type Parameters:
        T - type of the return value
        Parameters:
        internal - the call to be done
        exceptionhandler - the exception handler. May throw RuntimeException or return some default value.
        Returns:
        the result
        Throws:
        RuntimeException - in case of error
      • staged

        static <T> CompletionStage<T> staged​(Callable<T> internal)
        Used internally to support the exception interception.
        Type Parameters:
        T - type of the return value
        Parameters:
        internal - the call to be done
        Returns:
        the completion stage
        Throws:
        RuntimeException - in case of error
      • throwingHandler

        default Function<Exception,TthrowingHandler()
        Used internally to support the exception interception.
        Returns:
        exception handler to support exception control