@FunctionalInterface public interface ThrowingBooleanSupplier extends BooleanSupplier
boolean-valued results, possibly throwing an exception.| Modifier and Type | Method and Description |
|---|---|
default BooleanSupplier |
fallbackTo(BooleanSupplier fallback)
Returns a
BooleanSupplier returning from the given supplier if this supplier throws an exception. |
default BooleanSupplier |
fallbackTo(BooleanSupplier fallback,
Consumer<Exception> exceptionConsumer)
Returns a
BooleanSupplier returning from the given supplier if this supplier throws an exception. |
default boolean |
getAsBoolean()
Returns a result.
|
boolean |
getAsBooleanThrowing()
Returns a result.
|
default BooleanSupplier |
orReturn(boolean value)
Returns a
BooleanSupplier returning the given value if this supplier throws an exception. |
default BooleanSupplier |
orReturn(boolean value,
Consumer<Exception> exceptionConsumer)
Returns a
BooleanSupplier returning the given value if this supplier throws an exception. |
default ThrowingBooleanSupplier |
orThrow(Class<? extends RuntimeException> exceptionClass)
Returns a
ThrowingBooleanSupplier throwing an exception of the given type if this supplier throws an exception. |
default ThrowingBooleanSupplier |
orThrow(Class<? extends RuntimeException> exceptionClass,
String message)
Returns a
ThrowingBooleanSupplier throwing an exception of the given type if this supplier throws an exception. |
default ThrowingBooleanSupplier |
orTryWith(ThrowingBooleanSupplier other)
Returns a
ThrowingBooleanSupplier returning from the given supplier if this supplier throws an exception. |
default ThrowingBooleanSupplier |
orTryWith(ThrowingBooleanSupplier other,
Consumer<Exception> exceptionConsumer)
Returns a
ThrowingBooleanSupplier returning from the given supplier if this supplier throws an exception. |
default BooleanSupplier fallbackTo(BooleanSupplier fallback)
BooleanSupplier returning from the given supplier if this supplier throws an exception.IllegalArgumentException - if fallback is nulldefault BooleanSupplier fallbackTo(BooleanSupplier fallback, Consumer<Exception> exceptionConsumer)
BooleanSupplier returning from the given supplier if this supplier throws an exception.IllegalArgumentException - if fallback is nulldefault boolean getAsBoolean()
UncheckedException.getAsBoolean in interface BooleanSupplierboolean getAsBooleanThrowing()
throws Exception
Exceptiondefault BooleanSupplier orReturn(boolean value)
BooleanSupplier returning the given value if this supplier throws an exception.default BooleanSupplier orReturn(boolean value, Consumer<Exception> exceptionConsumer)
BooleanSupplier returning the given value if this supplier throws an exception.default ThrowingBooleanSupplier orThrow(Class<? extends RuntimeException> exceptionClass)
ThrowingBooleanSupplier 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.
IllegalArgumentException - if exceptionClass is nulldefault ThrowingBooleanSupplier orThrow(Class<? extends RuntimeException> exceptionClass, String message)
ThrowingBooleanSupplier 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.
IllegalArgumentException - if exceptionClass is nulldefault ThrowingBooleanSupplier orTryWith(ThrowingBooleanSupplier other)
ThrowingBooleanSupplier returning from the given supplier if this supplier throws an exception.IllegalArgumentException - if other is nulldefault ThrowingBooleanSupplier orTryWith(ThrowingBooleanSupplier other, Consumer<Exception> exceptionConsumer)
ThrowingBooleanSupplier returning from the given supplier if this supplier throws an exception.IllegalArgumentException - if other is null