Package com.nomagic.uml2.transaction
Interface TransactionCommitListener
public interface TransactionCommitListener
Listener to listen transactions commits.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Invoked when all transactions are already committed.static Runnable
toRunnable
(Collection<Runnable> runnable) Merges given Runnables to a single composite Runnablestatic <T> Runnable
toRunnable
(Collection<T> elements, Consumer<T> consumer) Creates consumer which consumes all elements from given collectionstatic Runnable
toRunnable
(Stream<Runnable> runnableStream) Merges given Runnables to a single composite RunnableNotifies listener that transaction is committed and provides changes done in transaction.
-
Method Details
-
transactionCommited
Notifies listener that transaction is committed and provides changes done in transaction. Listener can returnRunnable
which modifies model after all listeners are notified.- Parameters:
events
- events recorded during transaction.- Returns:
Runnable
which will be run to modify model after all listeners are notified. Can be null.
-
allTransactionsCommitted
default void allTransactionsCommitted()Invoked when all transactions are already committed. -
toRunnable
Merges given Runnables to a single composite Runnable- Parameters:
runnable
- runnables- Returns:
- composite Runnable or null if given runnables are empty
-
toRunnable
Merges given Runnables to a single composite Runnable- Parameters:
runnableStream
- stream of Runnable- Returns:
- composite Runnable or null if given stream is empty
-
toRunnable
@CheckForNull static <T> Runnable toRunnable(@CheckForNull Collection<T> elements, Consumer<T> consumer) Creates consumer which consumes all elements from given collection- Parameters:
elements
- elements to be consumedconsumer
- consumer- Returns:
- runnable or null if elements collection is null or empty
-