Package dev.morphia

Interface EntityListener<T>

Type Parameters:
T - the listener type

public interface EntityListener<T>
Defines a listener on an entity and default placeholders for the various types. The named methods below can be used for semantic convenience or new methods maybe be defined if, e.g., you need multiple handlers of the same event. Any method defined on subtypes must be annotated with a lifecycle event annotation. See the methods for each type below for details.
  • Method Details

    • hasAnnotation

      boolean hasAnnotation(Class<? extends Annotation> type)
      This method checks for the presence of the given lifecycle event annotation on any of the methods of the type implementing this interface.
      Parameters:
      type - the annotation type to check for
      Returns:
      true if the annotation is found on a method on this type.
    • postLoad

      default void postLoad(T entity, Document document, Datastore datastore)
      Parameters:
      entity - the entity being processed
      document - the Document form of the entity
      datastore - the Datastore being used
      Since:
      2.3
      See Also:
    • postPersist

      default void postPersist(T entity, Document document, Datastore datastore)
      Parameters:
      entity - the entity being processed
      document - the Document form of the entity
      datastore - the Datastore being used
      Since:
      2.3
      See Also:
    • preLoad

      default void preLoad(T entity, Document document, Datastore datastore)
      Parameters:
      entity - the entity being processed
      document - the Document form of the entity
      datastore - the Datastore being used
      Since:
      2.3
      See Also:
    • prePersist

      default void prePersist(T entity, Document document, Datastore datastore)
      Parameters:
      entity - the entity being processed
      document - the Document form of the entity
      datastore - the Datastore being used
      Since:
      2.3
      See Also: