public class Exceptions extends Object
Modifier and Type | Method and Description |
---|---|
static <T,U> BiConsumer<T,U> |
checkedConsumer(CheckedBiConsumer<T,U> checkedBiConsumer)
Adapt a
CheckedBiConsumer to a BiConsumer propagating any exceptions thrown by the CheckedBiConsumer
using Exceptions.propagate(Throwable) . |
static <T> Consumer<T> |
checkedConsumer(CheckedConsumer<T> checkedConsumer)
Adapt a
CheckedConsumer to a Consumer propagating any exceptions thrown by the CheckedConsumer using
Exceptions.propagate(Throwable) . |
static <T,U,R> BiFunction<T,U,R> |
checkedFunction(CheckedBiFunction<T,U,R> checkedBiFunction)
Adapt a
CheckedBiFunction to a BiFunction propagating any exceptions thrown by the CheckedBiFunction
using Exceptions.propagate(Throwable) . |
static <T,R> Function<T,R> |
checkedFunction(CheckedFunction<T,R> checkedFunction)
Adapt a
CheckedFunction to a Function propagating any exceptions thrown by the CheckedFunction using
Exceptions.propagate(Throwable) . |
static <T,U> BiPredicate<T,U> |
checkedPredicate(CheckedBiPredicate<T,U> checkedBiPredicate)
Adapt a
CheckedBiPredicate to a BiPredicate propagating any exceptions thrown by the
CheckedBiPredicate using Exceptions.propagate(Throwable) . |
static <T> Predicate<T> |
checkedPredicate(CheckedPredicate<T> checkedPredicate)
Adapt a
CheckedPredicate to a Predicate propagating any exceptions thrown by the CheckedPredicate
using Exceptions.propagate(Throwable) . |
static RuntimeException |
propagateWrappingFatal(Throwable t)
Propagate an exception through streams even if it's considered fatal by Reactor.
|
static MuleException |
rxExceptionToMuleException(Throwable throwable)
Unwrap reactive exception and rethrow instances
MuleException or RuntimeException . |
static Throwable |
unwrap(Throwable throwable)
Unwrap a particular
Throwable . |
static Throwable |
wrapFatal(Throwable t)
Wrap an exception with
MuleFatalException so that Reactor can handle it safely instead of always bubbling it up. |
public static <T> Consumer<T> checkedConsumer(CheckedConsumer<T> checkedConsumer)
CheckedConsumer
to a Consumer
propagating any exceptions thrown by the CheckedConsumer
using
Exceptions.propagate(Throwable)
. Useful when using existing methods which throw checked exceptions to
avoid try/catch blocks and improve readability.
flux.subscribe(Exceptions.checked(v -> checkedMethod(v)
T
- the type of the input to the operationcheckedConsumer
- the consumer that throws a checked exceptionCheckedConsumer
and Exceptions.propagate(Throwable)
's checked
exceptionsExceptions.propagate(Throwable)
public static <T,U> BiConsumer<T,U> checkedConsumer(CheckedBiConsumer<T,U> checkedBiConsumer)
CheckedBiConsumer
to a BiConsumer
propagating any exceptions thrown by the CheckedBiConsumer
using Exceptions.propagate(Throwable)
. Useful when using existing methods which throw checked exceptions
to avoid try/catch blocks and improve readability.T
- the type of the first argument to the operationU
- the type of the second argument to the operationcheckedBiConsumer
- the biconsumer that throws a chedked exceptionCheckedBiConsumer
and Exceptions.propagate(Throwable)
's checked
exceptionsExceptions.propagate(Throwable)
public static <T,R> Function<T,R> checkedFunction(CheckedFunction<T,R> checkedFunction)
CheckedFunction
to a Function
propagating any exceptions thrown by the CheckedFunction
using
Exceptions.propagate(Throwable)
. Useful when using existing methods which throw checked exceptions to
avoid try/catch blocks and improve readability.
flux.map(Exceptions.checked(v -> checkedMethod(v)).subscribe(Subscribers.unbounded())
T
- the type of the input to the functionR
- the type of the result of the functioncheckedFunction
- the function that throws a checked exceptionCheckedFunction
and Exceptions.propagate(Throwable)
's checked
exceptionsExceptions.propagate(Throwable)
public static <T,U,R> BiFunction<T,U,R> checkedFunction(CheckedBiFunction<T,U,R> checkedBiFunction)
CheckedBiFunction
to a BiFunction
propagating any exceptions thrown by the CheckedBiFunction
using Exceptions.propagate(Throwable)
. Useful when using existing methods which throw checked exceptions
to avoid try/catch blocks and improve readability.T
- the type of the first argument to the functionU
- the type of the second argument to the functionR
- the type of the result of the functioncheckedBiFunction
- the bifunction that throws a checked exceptionCheckedBiFunction
and Exceptions.propagate(Throwable)
's checked
exceptionsExceptions.propagate(Throwable)
public static <T> Predicate<T> checkedPredicate(CheckedPredicate<T> checkedPredicate)
CheckedPredicate
to a Predicate
propagating any exceptions thrown by the CheckedPredicate
using Exceptions.propagate(Throwable)
. Useful when using existing methods which throw checked exceptions
to avoid try/catch blocks and improve readability.
flux.filter(Exceptions.checked(v -> checkedMethod(v)).subscribe(Subscribers.unbounded())
T
- the type of the input to the predicatecheckedPredicate
- the predicate that throws a checked exceptionCheckedPredicate
and Exceptions.propagate(Throwable)
's checked
exceptionsExceptions.propagate(Throwable)
public static <T,U> BiPredicate<T,U> checkedPredicate(CheckedBiPredicate<T,U> checkedBiPredicate)
CheckedBiPredicate
to a BiPredicate
propagating any exceptions thrown by the
CheckedBiPredicate
using Exceptions.propagate(Throwable)
. Useful when using existing methods
which throw checked exceptions to avoid try/catch blocks and improve readability.T
- the type of the first argument to the predicateU
- the type of the second argument the predicatecheckedBiPredicate
- the bipredicate that throws a checked exceptionCheckedBiPredicate
and Exceptions.propagate(Throwable)
's checked
exceptionsExceptions.propagate(Throwable)
public static MuleException rxExceptionToMuleException(Throwable throwable) throws MuleException
MuleException
or RuntimeException
. Other exception types are
wrapped in a instance of DefaultMuleException
.throwable
- MuleException
public static Throwable unwrap(Throwable throwable)
Throwable
.throwable
- the exception to wrappublic static RuntimeException propagateWrappingFatal(Throwable t)
t
- throwable.MuleFatalException
.public static Throwable wrapFatal(Throwable t)
MuleFatalException
so that Reactor can handle it safely instead of always bubbling it up.t
- throwable.Copyright © 2018. All rights reserved.