java.util.function.Supplier<T>@FunctionalInterface
public interface ThrowingSupplier<T>
extends java.util.function.Supplier<T>
| Modifier and Type | Method | Description |
|---|---|---|
default java.util.function.Supplier<T> |
fallbackTo(java.util.function.Supplier<T> fallback) |
Returns a
Supplier returning from the given supplier if this supplier throws an exception. |
default java.util.function.Supplier<T> |
fallbackTo(java.util.function.Supplier<T> fallback,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
Supplier returning from the given supplier if this supplier throws an exception. |
default T |
get() |
Returns a result.
|
T |
getThrowing() |
Returns a result.
|
default java.util.function.Supplier<T> |
orReturn(T value) |
Returns a
Supplier returning the given value if this supplier throws an exception. |
default java.util.function.Supplier<T> |
orReturn(T value,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
Supplier returning the given value if this supplier throws an exception. |
default ThrowingSupplier<T> |
orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass) |
Returns a
ThrowingSupplier throwing an exception of the given type if this supplier throws an exception. |
default ThrowingSupplier<T> |
orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass,
java.lang.String message) |
Returns a
ThrowingSupplier throwing an exception of the given type if this supplier throws an exception. |
default ThrowingSupplier<T> |
orTryWith(ThrowingSupplier<? extends T> other) |
Returns a
ThrowingSupplier returning from the given supplier if this supplier throws an exception. |
default ThrowingSupplier<T> |
orTryWith(ThrowingSupplier<? extends T> other,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
ThrowingSupplier returning from the given supplier if this supplier throws an exception. |
default java.util.function.Supplier<T> fallbackTo(java.util.function.Supplier<T> fallback)
Supplier returning from the given supplier if this supplier throws an exception.java.lang.IllegalArgumentException - if fallback is nulldefault java.util.function.Supplier<T> fallbackTo(java.util.function.Supplier<T> fallback, java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
Supplier returning from the given supplier if this supplier throws an exception.java.lang.IllegalArgumentException - if fallback is nulldefault T get()
UncheckedException.get in interface java.util.function.Supplier<T>T getThrowing() throws java.lang.Exception
java.lang.Exceptiondefault java.util.function.Supplier<T> orReturn(T value)
Supplier returning the given value if this supplier throws an exception.default java.util.function.Supplier<T> orReturn(T value, java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
Supplier returning the given value if this supplier throws an exception.default ThrowingSupplier<T> orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass)
ThrowingSupplier throwing an exception of the given type if this supplier throws an exception.
The original exception thrown by this supplier is the cause of the thrown exception.
The exception class must have a constructor accepting a single Throwable as an argument.
java.lang.IllegalArgumentException - if exceptionClass is nulldefault ThrowingSupplier<T> orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass, java.lang.String message)
ThrowingSupplier throwing an exception of the given type if this supplier throws an exception.
The original exception thrown by this supplier is the cause of the thrown exception.
The exception class must have a constructor accepting String and Throwable as arguments.
java.lang.IllegalArgumentException - if exceptionClass is nulldefault ThrowingSupplier<T> orTryWith(ThrowingSupplier<? extends T> other)
ThrowingSupplier returning from the given supplier if this supplier throws an exception.java.lang.IllegalArgumentException - if other is nulldefault ThrowingSupplier<T> orTryWith(ThrowingSupplier<? extends T> other, java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
ThrowingSupplier returning from the given supplier if this supplier throws an exception.java.lang.IllegalArgumentException - if other is null