Reformatted code and added documentation

This commit is contained in:
bluefireoly
2020-10-18 17:16:04 +02:00
parent dcdb817a7c
commit f606fac7a4

View File

@@ -12,6 +12,9 @@ abstract class ChainedRunnablePart<T, R>(
protected abstract fun invoke(data: T): R protected abstract fun invoke(data: T): R
/**
* Begins execution of this chained runnable.
*/
abstract fun execute() abstract fun execute()
/** /**
@@ -71,6 +74,7 @@ abstract class ChainedRunnablePart<T, R>(
next?.startCatching(result, exceptionClass, exceptionSync, exceptionHandler) next?.startCatching(result, exceptionClass, exceptionSync, exceptionHandler)
} }
} }
} }
class ChainedRunnablePartFirst<R>( class ChainedRunnablePartFirst<R>(
@@ -85,8 +89,7 @@ class ChainedRunnablePartFirst<R>(
exceptionClass: KClass<E>, exceptionClass: KClass<E>,
exceptionSync: Boolean, exceptionSync: Boolean,
exceptionHandler: ((E) -> Unit)? exceptionHandler: ((E) -> Unit)?
) = ) = startCatching(Unit, exceptionClass, exceptionSync, exceptionHandler)
startCatching(Unit, exceptionClass, exceptionSync, exceptionHandler)
override fun invoke(data: Unit) = runnable.invoke() override fun invoke(data: Unit) = runnable.invoke()
@@ -105,8 +108,7 @@ class ChainedRunnablePartThen<T, R>(
exceptionClass: KClass<E>, exceptionClass: KClass<E>,
exceptionSync: Boolean, exceptionSync: Boolean,
exceptionHandler: ((E) -> Unit)? exceptionHandler: ((E) -> Unit)?
) = ) = previous.executeCatchingImpl(exceptionClass, exceptionSync, exceptionHandler)
previous.executeCatchingImpl(exceptionClass, exceptionSync, exceptionHandler)
override fun invoke(data: T) = runnable.invoke(data) override fun invoke(data: T) = runnable.invoke(data)