Errors.ConstrainedTo<E extends Throwable>, Errors.Handling, Errors.Plugins, Errors.Rethrowing, Errors.WrappedAsRuntimeException| Modifier | Constructor and Description |
|---|---|
protected |
Handling(Consumer<Throwable> error) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getWithDefault(Throwing.Supplier<T> supplier,
T onFailure)
Attempts to call
supplier and returns onFailure if an exception is thrown. |
<T,R> Function<T,R> |
wrapFunctionWithDefault(Throwing.Function<T,R> function,
R onFailure)
Returns a Function which wraps
function and returns onFailure if an exception is thrown. |
<T> Predicate<T> |
wrapPredicateWithDefault(Throwing.Predicate<T> predicate,
boolean onFailure)
Returns a Predicate which wraps
predicate and returns onFailure if an exception is thrown. |
<T,R> Function<T,R> |
wrapWithDefault(Throwing.Function<T,R> function,
R onFailure)
Returns a Function which wraps
function and returns onFailure if an exception is thrown. |
<T> Predicate<T> |
wrapWithDefault(Throwing.Predicate<T> predicate,
boolean onFailure)
Returns a Predicate which wraps
predicate and returns onFailure if an exception is thrown. |
<T> Supplier<T> |
wrapWithDefault(Throwing.Supplier<T> supplier,
T onFailure)
Returns a Supplier which wraps
supplier and returns onFailure if an exception is thrown. |
accept, asRuntime, asTerminal, constrainTo, createHandling, createRethrowing, dialog, log, rethrow, run, suppress, wrap, wrappublic <T> T getWithDefault(Throwing.Supplier<T> supplier, @Nullable T onFailure)
Attempts to call supplier and returns onFailure if an exception is thrown.
public <T> Supplier<T> wrapWithDefault(Throwing.Supplier<T> supplier, @Nullable T onFailure)
Returns a Supplier which wraps supplier and returns onFailure if an exception is thrown.
public <T,R> Function<T,R> wrapWithDefault(Throwing.Function<T,R> function, @Nullable R onFailure)
Returns a Function which wraps function and returns onFailure if an exception is thrown.
If you are getting an error about the method wrapWithDefault is ambiguous, use #wrapFunctionWithDefault(com.diffplug.common.base.Throwing.Function) or {@link #wrapPredicateWithDefault(com.diffplug.common.base.Throwing.Predicate).
public <T> Predicate<T> wrapWithDefault(Throwing.Predicate<T> predicate, boolean onFailure)
Returns a Predicate which wraps predicate and returns onFailure if an exception is thrown.
If you are getting an error about the method wrapWithDefault is ambiguous, use #wrapFunctionWithDefault(com.diffplug.common.base.Throwing.Function) or {@link #wrapPredicateWithDefault(com.diffplug.common.base.Throwing.Predicate).
public <T,R> Function<T,R> wrapFunctionWithDefault(Throwing.Function<T,R> function, @Nullable R onFailure)
Returns a Function which wraps function and returns onFailure if an exception is thrown.
public <T> Predicate<T> wrapPredicateWithDefault(Throwing.Predicate<T> predicate, boolean onFailure)
Returns a Predicate which wraps predicate and returns onFailure if an exception is thrown.