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 Summary
Modifier and TypeMethodDescriptionboolean
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.default void
default void
postPersist
(T entity, Document document, Datastore datastore) default void
default void
prePersist
(T entity, Document document, Datastore datastore)
-
Method Details
-
hasAnnotation
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
- Parameters:
entity
- the entity being processeddocument
- the Document form of the entitydatastore
- the Datastore being used- Since:
- 2.3
- See Also:
-
postPersist
- Parameters:
entity
- the entity being processeddocument
- the Document form of the entitydatastore
- the Datastore being used- Since:
- 2.3
- See Also:
-
preLoad
- Parameters:
entity
- the entity being processeddocument
- the Document form of the entitydatastore
- the Datastore being used- Since:
- 2.3
- See Also:
-
prePersist
- Parameters:
entity
- the entity being processeddocument
- the Document form of the entitydatastore
- the Datastore being used- Since:
- 2.3
- See Also:
-