Package io.keikai.doc.collab.utils
Class EventHandler<T>
java.lang.Object
io.keikai.doc.collab.utils.EventHandler<T>
General event handler implementation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voidaddEventHandlerListener(EventHandler eventHandler, BiConsumer<T, Transaction> function) Adds an event listener that is called whencallEventHandlerListeners(io.keikai.doc.collab.utils.EventHandler, T, io.keikai.doc.collab.utils.Transaction)is called.static <T> voidaddEventHandlerListener(EventHandler eventHandler, Consumer<T> function) Adds an event listener that is called whencallEventHandlerListeners(io.keikai.doc.collab.utils.EventHandler, T, io.keikai.doc.collab.utils.Transaction)is called.static <T> voidcallEventHandlerListeners(EventHandler eventHandler, T event, Transaction transaction) Call all event listeners that were added viaaddEventHandlerListener(io.keikai.doc.collab.utils.EventHandler, java.util.function.Consumer<T>).static EventHandlergetList()static <T> voidremoveEventHandlerListener(EventHandler eventHandler, BiConsumer<T, Transaction> function) Removes an event listener.
-
Constructor Details
-
EventHandler
public EventHandler()
-
-
Method Details
-
getList
-
createEventHandler
-
addEventHandlerListener
Adds an event listener that is called whencallEventHandlerListeners(io.keikai.doc.collab.utils.EventHandler, T, io.keikai.doc.collab.utils.Transaction)is called.- Parameters:
eventHandler-function-
-
addEventHandlerListener
public static <T> void addEventHandlerListener(EventHandler eventHandler, BiConsumer<T, Transaction> function) Adds an event listener that is called whencallEventHandlerListeners(io.keikai.doc.collab.utils.EventHandler, T, io.keikai.doc.collab.utils.Transaction)is called.- Parameters:
eventHandler-function-
-
removeEventHandlerListener
public static <T> void removeEventHandlerListener(EventHandler eventHandler, BiConsumer<T, Transaction> function) Removes an event listener.- Parameters:
eventHandler-function-
-
callEventHandlerListeners
public static <T> void callEventHandlerListeners(EventHandler eventHandler, T event, Transaction transaction) Call all event listeners that were added viaaddEventHandlerListener(io.keikai.doc.collab.utils.EventHandler, java.util.function.Consumer<T>).- Parameters:
eventHandler-
-