| Modifier and Type | Method and Description |
|---|---|
T |
fallback()
Returns the associated
subject. |
static <T extends Throwable> |
of(T subject)
Initiates a
Handling of the given subject. |
<X extends Throwable> |
reThrowCauseIf(Class<X> type)
|
<X extends Throwable> |
reThrowIf(Class<X> type)
Re-throws the associated subject if it matches the given exception
type. |
<X extends Throwable> |
throwMapped(Function<? super T,X> mapping)
|
<X extends Throwable> |
throwMappedCause(Function<Throwable,X> mapping)
Applies the given
mapping to the cause of the
associated subject and throws the result if is it NOT null. |
public static <T extends Throwable> Handling<T> of(T subject)
Handling of the given subject.public final <X extends Throwable> Handling<T> throwMapped(Function<? super T,X> mapping) throws X extends Throwable
Applies the given mapping to the associated subject and throws the result
if is it NOT null. Otherwise this Handling will be returned.
This method is used to re-specify an exception. For example, if an exception was caught as a very common
type, e.g. an Exception. At the same time, a suitable mapping to the respective exception can be
applied with this variant.
X extends ThrowablereThrowIf(Class)public final <X extends Throwable> Handling<T> reThrowIf(Class<X> type) throws X extends Throwable
Re-throws the associated subject if it matches the given exception type.
Otherwise this Handling will be returned.
This method is used to re-specify an exception. For example, if an exception was caught as a very common
type, e.g. an Exception.
X extends ThrowablethrowMapped(Function)public final <X extends Throwable> Handling<T> throwMappedCause(Function<Throwable,X> mapping) throws X extends Throwable
Applies the given mapping to the cause of the
associated subject and throws the result if is it NOT null.
Otherwise this Handling will be returned.
This method is used to bring the cause of an exception back to the foreground. For example,
if an exception was previously caught and encapsulated in another exception for technical reasons,
e.g. a RuntimeException. At the same time, a suitable mapping to the respective exception can be
applied with this variant.
X extends ThrowablereThrowCauseIf(Class)public final <X extends Throwable> Handling<T> reThrowCauseIf(Class<X> type) throws X extends Throwable
Re-throws the cause of the associated subject
if it matches the given exception type. Otherwise this Handling will be returned.
This method is used to bring the cause of an exception back to the foreground. For example,
if an exception was previously caught and encapsulated in another exception for technical reasons,
e.g. a RuntimeException.
X extends ThrowablethrowMappedCause(Function)public final T fallback()
subject.Copyright © 2021. All rights reserved.