Uses of Interface
dk.cloudcreate.essentials.shared.functional.CheckedRunnable
-
Packages that use CheckedRunnable Package Description dk.cloudcreate.essentials.shared.functional -
-
Uses of CheckedRunnable in dk.cloudcreate.essentials.shared.functional
Methods in dk.cloudcreate.essentials.shared.functional with parameters of type CheckedRunnable Modifier and Type Method Description static RunnableCheckedRunnable. safe(CheckedRunnable runnableThatCanFailWithACheckedException)Wraps aCheckedRunnable(basically a lambda with no arguments that doesn't return any result and which throws a CheckedException) by returning a newRunnableinstance
The returnedRunnable.run()method delegates directly to therun()and catches any thrown checkedException's and rethrows them as aCheckedExceptionRethrownException
Unless you provide a context-message (usingsafe(String, CheckedRunnable)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 aRunnablewith the purpose of the calling theRunnable.run().static RunnableCheckedRunnable. safe(String contextMessage, CheckedRunnable runnableThatCanFailWithACheckedException)Wraps aCheckedRunnable(basically a lambda with no arguments that doesn't return any result and which throws a CheckedException) by returning a newRunnableinstance
The returnedRunnable.run()method delegates directly to therun()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 aRunnablewith the purpose of the calling theRunnable.run().
-