Uses of Interface
dk.cloudcreate.essentials.shared.functional.CheckedSupplier
-
Packages that use CheckedSupplier Package Description dk.cloudcreate.essentials.shared.functional -
-
Uses of CheckedSupplier in dk.cloudcreate.essentials.shared.functional
Methods in dk.cloudcreate.essentials.shared.functional with parameters of type CheckedSupplier Modifier and Type Method Description static <R> Supplier<R>CheckedSupplier. safe(CheckedSupplier<R> supplierThatCanFailedWithACheckedException)Wraps aCheckedSupplier(basically a lambda with no arguments that returns a result and which throws a CheckedException) by returning a newSupplierinstance
The returnedSupplier.get()method delegates directly to theget()and catches any thrown checkedException's and rethrows them as aCheckedExceptionRethrownException
Unless you provide a context-message (usingsafe(String, CheckedSupplier)then any caught checkedException's message also becomes theCheckedExceptionRethrownException's message.
AnyRuntimeException's thrown aren't caught and the calling code will receive the originalRuntimeExceptionthrown.
Usage example:
Let's say we have a method calledsomeOperationthat cannot change, but which accepts aSupplierwith the purpose of the calling theSupplier.get().static <R> Supplier<R>CheckedSupplier. safe(String contextMessage, CheckedSupplier<R> supplierThatCanFailedWithACheckedException)Wraps aCheckedSupplier(basically a lambda with no arguments that returns a result and which throws a CheckedException) by returning a newSupplierinstance
The returnedSupplier.get()method delegates directly to theget()and catches any thrown checkedException's and rethrows them as aCheckedExceptionRethrownException
AnyRuntimeException's thrown aren't caught and the calling code will receive the originalRuntimeExceptionthrown.
Usage example:
Let's say we have a method calledsomeOperationthat cannot change, but which accepts aSupplierwith the purpose of the calling theSupplier.get().
-