Class FutureUtils

    • Method Detail

      • futureToPromise

        public static <T,​E extends ExceptionPromise<T,​E> futureToPromise​(CompletionStage<T> completionStage,
                                                                                       Class<E> exceptionType)
        Converts a CompletionStage to a Promise.
        Type Parameters:
        T - The type's result expected by the promise.
        E - The type of the exception expected by the promise.
        Parameters:
        completionStage - The completion stage to convert.
        exceptionType - The expected exception type, not null.
        Returns:
        The equivalent as a Promise.
        Throws:
        NullPointerException - if the exceptionType is null.