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.
@FunctionalInterface public static interface KiwiRunnables.ThrowingRunnable
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static KiwiRunnables.ThrowingRunnableof(Runnable runnable)Convert a plainRunnableinto aKiwiRunnables.ThrowingRunnable.voidrun()Does something that might throw a checked exception.default org.kiwiproject.base.CatchingRunnabletoCatchingRunnable()Converts this instance to aCatchingRunnable.default CatchingRunnable2toCatchingRunnable2()Converts this instance to aCatchingRunnable2.default RunnabletoRunnable()Converts this instance to aRunnablewhich catches anyExceptionthat is thrown and wraps it in aRuntimeException.
-
-
-
Method Detail
-
run
void run() throws Exception
Does something that might throw a checked exception.- Throws:
Exception- if something went wrong
-
of
static KiwiRunnables.ThrowingRunnable of(Runnable runnable)
Convert a plainRunnableinto aKiwiRunnables.ThrowingRunnable.- Parameters:
runnable- the Runnable to convert- Returns:
- a new ThrowingRunnable that wraps the original Runnable
-
toRunnable
default 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
default CatchingRunnable2 toCatchingRunnable2()
Converts this instance to aCatchingRunnable2.- Returns:
- a new CatchingRunnable2 instance
-
-