T - some generic flagE - The extension@FunctionalInterface public interface SupplierWithThrowable<T,E extends Throwable> extends Supplier<T>
| Modifier and Type | Method and Description |
|---|---|
static <T,E extends Throwable> |
asSupplierWithThrowable(Supplier<T> supplier)
Utility method to convert SupplierWithThrowable
|
static <T,E extends Throwable> |
aSupplierThatUnsafelyThrowsUnchecked(SupplierWithThrowable<T,E> supplierwiththrowable)
Utility method to unwrap lambdas of type Supplier and withUncheckedThrowable any Exception
|
static <T,E extends Throwable> |
castSupplierWithThrowable(SupplierWithThrowable<T,E> supplierwiththrowable)
Utility method to mark lambdas of type SupplierWithThrowable
|
default T |
get()
Overridden method of SupplierWithThrowable that will call getWithThrowable, but catching any exceptions.
|
T |
getWithThrowable()
Functional method that will throw exceptions.
|
default SupplierWithThrowable<T,E> |
onException(Consumer<Throwable> consumer) |
default Supplier<T> |
thatReturnsOnCatch(T defaultReturnValue) |
default Supplier<Optional<T>> |
thatReturnsOptional() |
default Supplier<T> |
thatUnsafelyThrowsUnchecked() |
default SupplierWithThrowable<T,E> |
withLogging()
Will log WARNING level exceptions on logger if they occur within the interface
|
default SupplierWithThrowable<T,E> |
withLogging(org.slf4j.Logger logger)
Will log WARNING level exceptions on logger if they occur within the interface
|
default SupplierWithThrowable<T,E> |
withLogging(org.slf4j.Logger logger,
String message) |
static <T,E extends Throwable> SupplierWithThrowable<T,E> castSupplierWithThrowable(SupplierWithThrowable<T,E> supplierwiththrowable)
T - Generic that corresponds to the same generic on SupplierE - The type this interface is allowed to throwsupplierwiththrowable - The interface instancestatic <T,E extends Throwable> Supplier<T> aSupplierThatUnsafelyThrowsUnchecked(SupplierWithThrowable<T,E> supplierwiththrowable) throws E extends Throwable
T - Generic that corresponds to the same generic on SupplierE - The type this interface is allowed to throwsupplierwiththrowable - The interface instanceE - the original Exception from supplierwiththrowableE extends Throwablestatic <T,E extends Throwable> SupplierWithThrowable<T,E> asSupplierWithThrowable(Supplier<T> supplier)
T - Generic that corresponds to the same generic on SupplierE - The type this interface is allowed to throwsupplier - The interface instancedefault T get()
T getWithThrowable() throws E extends Throwable
default Supplier<Optional<T>> thatReturnsOptional()
default Supplier<T> thatReturnsOnCatch(T defaultReturnValue)
defaultReturnValue - A value to return if any throwable is caught.default Supplier<T> thatUnsafelyThrowsUnchecked() throws E extends Throwable
default SupplierWithThrowable<T,E> withLogging(org.slf4j.Logger logger, String message)
logger - The logger to log exceptions onmessage - A message to use for logging exceptionsdefault SupplierWithThrowable<T,E> withLogging(org.slf4j.Logger logger)
logger - The logger instance to log exceptions ondefault SupplierWithThrowable<T,E> withLogging()
default SupplierWithThrowable<T,E> onException(Consumer<Throwable> consumer)
consumer - An exception consumer.Copyright © 2017. All rights reserved.