Package org.kiwiproject.beta.base
Interface KiwiRunnables.ThrowingRunnable
- Enclosing class:
- KiwiRunnables
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
-
Method Summary
Modifier and TypeMethodDescriptionConvert a plainRunnableinto aKiwiRunnables.ThrowingRunnable.voidrun()Does something that might throw a checked exception.default org.kiwiproject.base.CatchingRunnableConverts this instance to aCatchingRunnable.default CatchingRunnable2Converts this instance to aCatchingRunnable2.default RunnableConverts this instance to aRunnablewhich catches anyExceptionthat is thrown and wraps it in aRuntimeException.
-
Method Details
-
run
Does something that might throw a checked exception.- Throws:
Exception- if something went wrong
-
of
Convert a plainRunnableinto aKiwiRunnables.ThrowingRunnable.- Parameters:
runnable- the Runnable to convert- Returns:
- a new ThrowingRunnable that wraps the original Runnable
-
toRunnable
Converts this instance to aRunnablewhich catches anyExceptionthat is thrown and wraps it in aRuntimeException.- Returns:
- a new
Runnableinstance
-
toCatchingRunnable
default org.kiwiproject.base.CatchingRunnable toCatchingRunnable()Converts this instance to aCatchingRunnable.- Returns:
- a new CatchingRunnable instance
-
toCatchingRunnable2
Converts this instance to aCatchingRunnable2.- Returns:
- a new CatchingRunnable2 instance
-