public final class DiggExceptions extends Object
| Modifier and Type | Field and Description |
|---|---|
static Consumer<Exception> |
rethrowAnyException
This consumer rethrows any given
Exception as an unchecked RuntimeException. |
| Modifier and Type | Method and Description |
|---|---|
static <T,R> R |
applyUnchecked(ThrowingFunction<T,R,? extends Throwable> function,
T argument)
Immediately
apply the given function with the given argument,
and if needed, convert any thrown exceptions to unckecked. |
static RuntimeException |
asUnchecked(Throwable t) |
static <X extends Throwable> |
asUnchecked(X t,
Function<? super X,String> message) |
static Stream<Throwable> |
causalChainOf(Throwable t) |
static String |
exceptionNameAndMessage(Throwable t) |
static <T> T |
getUnchecked(ThrowingSupplier<T,? extends Throwable> supplier)
Immediately
get a result from the given supplier,
and if needed, convert any thrown exceptions to unckecked. |
static <T,U,X extends Throwable> |
mayThrow(ThrowingBiConsumer<T,U,X> consumer)
Convenience to acquire a
ThrowingBiConsumer-reference from a lambda expression. |
static <T,U,R,X extends Throwable> |
mayThrow(ThrowingBiFunction<T,U,R,X> bifunction)
Convenience to acquire a
ThrowingBiFunction-reference from a lambda expression. |
static <T,X extends Throwable> |
mayThrow(ThrowingConsumer<T,X> consumer)
Convenience to acquire a
ThrowingConsumer-reference from a lambda expression. |
static <T,R,X extends Throwable> |
mayThrow(ThrowingFunction<T,R,X> function)
Convenience to acquire a
ThrowingFunction-reference from a lambda expression. |
static <T,X extends Throwable> |
mayThrow(ThrowingRunnable<X> runnable)
Convenience to acquire a
ThrowingRunnable-reference from a lambda expression. |
static <T,X extends Throwable> |
mayThrow(ThrowingSupplier<T,X> supplier)
Convenience to acquire a
ThrowingSupplier-reference from a lambda expression. |
static <T extends Throwable> |
rethrow(Function<T,? extends RuntimeException> createUnchecked)
Create a exception handler (
Consumer) which simply rethrows given exceptions. |
static void |
runUnchecked(ThrowingRunnable<? extends Throwable> runnable)
Immediately
run the given runnable,
and if needed, convert any thrown exceptions to unckecked. |
public static final Consumer<Exception> rethrowAnyException
Exception as an unchecked RuntimeException.public static Stream<Throwable> causalChainOf(Throwable t)
t - the Throwable to get the causal chain from.public static RuntimeException asUnchecked(Throwable t)
public static <X extends Throwable> RuntimeException asUnchecked(X t, Function<? super X,String> message)
public static <T,R> R applyUnchecked(ThrowingFunction<T,R,? extends Throwable> function, T argument)
apply the given function with the given argument,
and if needed, convert any thrown exceptions to unckecked.function - The ThrowingFunction.argument - The argument to pass to ThrowingFunction.apply(Object)public static <T> T getUnchecked(ThrowingSupplier<T,? extends Throwable> supplier)
get a result from the given supplier,
and if needed, convert any thrown exceptions to unckecked.supplier - The ThrowingSupplier.public static void runUnchecked(ThrowingRunnable<? extends Throwable> runnable)
run the given runnable,
and if needed, convert any thrown exceptions to unckecked.runnable - The ThrowingRunnable.public static final <T,R,X extends Throwable> ThrowingFunction<T,R,X> mayThrow(ThrowingFunction<T,R,X> function)
ThrowingFunction-reference from a lambda expression.public static final <T,U,R,X extends Throwable> ThrowingBiFunction<T,U,R,X> mayThrow(ThrowingBiFunction<T,U,R,X> bifunction)
ThrowingBiFunction-reference from a lambda expression.public static final <T,X extends Throwable> ThrowingSupplier<T,X> mayThrow(ThrowingSupplier<T,X> supplier)
ThrowingSupplier-reference from a lambda expression.public static final <T,X extends Throwable> ThrowingConsumer<T,X> mayThrow(ThrowingConsumer<T,X> consumer)
ThrowingConsumer-reference from a lambda expression.public static final <T,U,X extends Throwable> ThrowingBiConsumer<T,U,X> mayThrow(ThrowingBiConsumer<T,U,X> consumer)
ThrowingBiConsumer-reference from a lambda expression.public static final <T,X extends Throwable> ThrowingRunnable<X> mayThrow(ThrowingRunnable<X> runnable)
ThrowingRunnable-reference from a lambda expression.public static final <T extends Throwable> Consumer<T> rethrow(Function<T,? extends RuntimeException> createUnchecked)
Consumer) which simply rethrows given exceptions.createUnchecked - a function to convert a (typically) checked exception to RuntimeException.Consumer which rethrows any given exception.Copyright © 2016 Digipost. All rights reserved.