Class EntityEditEvents

java.lang.Object
is.codion.framework.model.EntityEditEvents

public final class EntityEditEvents extends Object
A central event hub for listening for entity inserts, updates and deletes. You must keep a live reference to any listeners added in order to prevent them from being garbage collected, since listeners are added via a WeakReference. EntityEditModel uses this to post its events.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addDeleteListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Collection<is.codion.framework.domain.entity.Entity>> listener)
    Adds a delete listener, notified each time entities of the given type are deleted.
    static void
    addInsertListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Collection<is.codion.framework.domain.entity.Entity>> listener)
    Adds an insert listener, notified each time entities of the given type are inserted.
    static void
    addUpdateListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Map<is.codion.framework.domain.entity.Entity.Key,is.codion.framework.domain.entity.Entity>> listener)
    Adds an update listener, notified each time entities of the given type are updated.
    static void
    deleted(Collection<is.codion.framework.domain.entity.Entity> deletedEntities)
    Notifies delete
    static void
    inserted(Collection<is.codion.framework.domain.entity.Entity> insertedEntities)
    Notifies insert
    static void
    removeDeleteListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Collection<is.codion.framework.domain.entity.Entity>> listener)
    Removes the given listener
    static void
    removeInsertListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Collection<is.codion.framework.domain.entity.Entity>> listener)
    Removes the given listener
    static void
    removeUpdateListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Map<is.codion.framework.domain.entity.Entity.Key,is.codion.framework.domain.entity.Entity>> listener)
    Removes the given listener
    static void
    updated(Map<is.codion.framework.domain.entity.Entity.Key,is.codion.framework.domain.entity.Entity> updatedEntities)
    Notifies update

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • addInsertListener

      public static void addInsertListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Collection<is.codion.framework.domain.entity.Entity>> listener)
      Adds an insert listener, notified each time entities of the given type are inserted. Note that you have to keep a live reference to the listener instance, otherwise it will be garbage collected, due to a weak reference.
      Parameters:
      entityType - the type of entity to listen for
      listener - the listener
    • addUpdateListener

      public static void addUpdateListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Map<is.codion.framework.domain.entity.Entity.Key,is.codion.framework.domain.entity.Entity>> listener)
      Adds an update listener, notified each time entities of the given type are updated. Note that you have to keep a live reference to the listener instance, otherwise it will be garbage collected, due to a weak reference.
      Parameters:
      entityType - the type of entity to listen for
      listener - the listener
    • addDeleteListener

      public static void addDeleteListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Collection<is.codion.framework.domain.entity.Entity>> listener)
      Adds a delete listener, notified each time entities of the given type are deleted. Note that you have to keep a live reference to the listener instance, otherwise it will be garbage collected, due to a weak reference.
      Parameters:
      entityType - the type of entity to listen for
      listener - the listener
    • removeInsertListener

      public static void removeInsertListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Collection<is.codion.framework.domain.entity.Entity>> listener)
      Removes the given listener
      Parameters:
      entityType - the entityType
      listener - the listener to remove
    • removeUpdateListener

      public static void removeUpdateListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Map<is.codion.framework.domain.entity.Entity.Key,is.codion.framework.domain.entity.Entity>> listener)
      Removes the given listener
      Parameters:
      entityType - the entityType
      listener - the listener to remove
    • removeDeleteListener

      public static void removeDeleteListener(is.codion.framework.domain.entity.EntityType entityType, Consumer<Collection<is.codion.framework.domain.entity.Entity>> listener)
      Removes the given listener
      Parameters:
      entityType - the entityType
      listener - the listener to remove
    • inserted

      public static void inserted(Collection<is.codion.framework.domain.entity.Entity> insertedEntities)
      Notifies insert
      Parameters:
      insertedEntities - the inserted entities
    • updated

      public static void updated(Map<is.codion.framework.domain.entity.Entity.Key,is.codion.framework.domain.entity.Entity> updatedEntities)
      Notifies update
      Parameters:
      updatedEntities - the updated entities mapped to their original primary key
    • deleted

      public static void deleted(Collection<is.codion.framework.domain.entity.Entity> deletedEntities)
      Notifies delete
      Parameters:
      deletedEntities - the deleted entities