Class AnnotatedMethodInvokingEntityEventListener
java.lang.Object
io.micronaut.data.runtime.event.listeners.AnnotatedMethodInvokingEntityEventListener
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,EntityEventListener<Object>,EventListener
@Singleton
public class AnnotatedMethodInvokingEntityEventListener
extends Object
implements EntityEventListener<Object>
Event listener that allows invoking methods defined on entities and annotated with an event annotation such as
PrePersist.- Since:
- 2.3.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.data.event.EntityEventListener
NOOPFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidpostLoad(@NonNull EntityEventContext<Object> context) A post-load hook.voidpostPersist(@NonNull EntityEventContext<Object> context) A post-persist hook.voidpostRemove(@NonNull EntityEventContext<Object> context) A post-remove hook.voidpostUpdate(@NonNull EntityEventContext<Object> context) A post-update hook.booleanprePersist(@NonNull EntityEventContext<Object> context) A pre-persist hook.booleanpreRemove(@NonNull EntityEventContext<Object> context) A pre-remove hook.booleanpreUpdate(@NonNull EntityEventContext<Object> context) A pre-update hook.booleansupports(RuntimePersistentEntity<Object> entity, Class<? extends Annotation> eventType) Allows including or excluding a listener for a specific entity.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.data.event.EntityEventListener
preQueryMethods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Constructor Details
-
AnnotatedMethodInvokingEntityEventListener
public AnnotatedMethodInvokingEntityEventListener()
-
-
Method Details
-
supports
public boolean supports(RuntimePersistentEntity<Object> entity, Class<? extends Annotation> eventType) Description copied from interface:EntityEventListenerAllows including or excluding a listener for a specific entity.- Specified by:
supportsin interfaceEntityEventListener<Object>- Parameters:
entity- The entityeventType- The event type- Returns:
- True if it is supported
-
prePersist
Description copied from interface:EntityEventListenerA pre-persist hook. Implementors can return false to evict the operation.- Specified by:
prePersistin interfaceEntityEventListener<Object>- Parameters:
context- The context object- Returns:
- A boolean value indicating whether to proceed with the operation.
-
postPersist
Description copied from interface:EntityEventListenerA post-persist hook. Executed once the object has been persisted.- Specified by:
postPersistin interfaceEntityEventListener<Object>- Parameters:
context- The context object
-
postLoad
Description copied from interface:EntityEventListenerA post-load hook. Executed once the object has been persisted.- Specified by:
postLoadin interfaceEntityEventListener<Object>- Parameters:
context- The context object
-
preRemove
Description copied from interface:EntityEventListenerA pre-remove hook. Implementors can return false to evict the operation.- Specified by:
preRemovein interfaceEntityEventListener<Object>- Parameters:
context- The context object- Returns:
- A boolean value indicating whether to proceed with the operation.
-
postRemove
Description copied from interface:EntityEventListenerA post-remove hook. Executed once the object has been removed.- Specified by:
postRemovein interfaceEntityEventListener<Object>- Parameters:
context- The context object
-
preUpdate
Description copied from interface:EntityEventListenerA pre-update hook. Implementors can return false to evict the operation.- Specified by:
preUpdatein interfaceEntityEventListener<Object>- Parameters:
context- The context object- Returns:
- A boolean value indicating whether to proceed with the operation.
-
postUpdate
Description copied from interface:EntityEventListenerA post-update hook. Executed once the object has been updated.- Specified by:
postUpdatein interfaceEntityEventListener<Object>- Parameters:
context- The context object
-