T - some generic flagR - some generic flagE - The extension@FunctionalInterface public interface FunctionWithThrowable<T,R,E extends Throwable> extends Function<T,R>
| 限定符和类型 | 方法和说明 |
|---|---|
static <T,R,E extends Throwable> |
aFunctionThatUnsafelyThrowsUnchecked(FunctionWithThrowable<T,R,E> functionwiththrowable)
Utility method to unwrap lambdas of type Function and withUncheckedThrowable any Exception
|
default R |
apply(T v1)
Overridden method of FunctionWithThrowable that will call applyWithThrowable, but catching any exceptions.
|
R |
applyWithThrowable(T v1)
Functional method that will throw exceptions.
|
static <T,R,E extends Throwable> |
asFunctionWithThrowable(Function<T,R> function)
Utility method to convert FunctionWithThrowable
|
static <T,R,E extends Throwable> |
castFunctionWithThrowable(FunctionWithThrowable<T,R,E> functionwiththrowable)
Utility method to mark lambdas of type FunctionWithThrowable
|
default FunctionWithThrowable<T,R,E> |
onException(BiConsumer<Throwable,Object[]> consumer) |
default FunctionWithThrowable<T,R,E> |
onException(Consumer<Throwable> consumer) |
default Function<T,R> |
thatReturnsOnCatch(R defaultReturnValue) |
default Function<T,Optional<R>> |
thatReturnsOptional() |
default Function<T,R> |
thatUnsafelyThrowsUnchecked() |
static <T,R,E extends Throwable> FunctionWithThrowable<T,R,E> castFunctionWithThrowable(FunctionWithThrowable<T,R,E> functionwiththrowable)
T - Generic that corresponds to the same generic on FunctionR - Generic that corresponds to the same generic on FunctionE - The type this interface is allowed to throwfunctionwiththrowable - The interface instancestatic <T,R,E extends Throwable> Function<T,R> aFunctionThatUnsafelyThrowsUnchecked(FunctionWithThrowable<T,R,E> functionwiththrowable) throws E extends Throwable
T - Generic that corresponds to the same generic on FunctionR - Generic that corresponds to the same generic on FunctionE - The type this interface is allowed to throwfunctionwiththrowable - The interface instanceE - the original Exception from functionwiththrowableE extends Throwablestatic <T,R,E extends Throwable> FunctionWithThrowable<T,R,E> asFunctionWithThrowable(Function<T,R> function)
T - Generic that corresponds to the same generic on FunctionR - Generic that corresponds to the same generic on FunctionE - The type this interface is allowed to throwfunction - The interface instancedefault R apply(T v1)
R applyWithThrowable(T v1) throws E extends Throwable
default Function<T,Optional<R>> thatReturnsOptional()
default Function<T,R> thatReturnsOnCatch(R defaultReturnValue)
defaultReturnValue - A value to return if any throwable is caught.default Function<T,R> thatUnsafelyThrowsUnchecked() throws E extends Throwable
default FunctionWithThrowable<T,R,E> onException(Consumer<Throwable> consumer)
consumer - An exception consumer.default FunctionWithThrowable<T,R,E> onException(BiConsumer<Throwable,Object[]> consumer)
consumer - An exception consumer.Copyright © 2020 com.github.braisdom. All rights reserved.