Package io.micronaut.data.runtime.event
Class EntityEventRegistry
- java.lang.Object
-
- io.micronaut.data.runtime.event.EntityEventRegistry
-
- All Implemented Interfaces:
io.micronaut.context.processor.AnnotationProcessor<EntityEventMapping,io.micronaut.inject.ExecutableMethod<?,?>>
,io.micronaut.context.processor.ExecutableMethodProcessor<EntityEventMapping>
,io.micronaut.core.order.Ordered
,EntityEventListener<java.lang.Object>
,java.util.EventListener
@Singleton @Primary public class EntityEventRegistry extends java.lang.Object implements EntityEventListener<java.lang.Object>, io.micronaut.context.processor.ExecutableMethodProcessor<EntityEventMapping>
Primary implementation of theEntityEventListener
interface that aggregates all other listeners.- Since:
- 2.3.0
- Author:
- graemerocher
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>>
EVENT_TYPES
-
Fields inherited from interface io.micronaut.data.event.EntityEventListener
NOOP
-
-
Constructor Summary
Constructors Constructor Description EntityEventRegistry(io.micronaut.context.BeanContext beanContext)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
postLoad(EntityEventContext<java.lang.Object> context)
A post-load hook.void
postPersist(EntityEventContext<java.lang.Object> context)
A post-persist hook.void
postRemove(EntityEventContext<java.lang.Object> context)
A post-remove hook.void
postUpdate(EntityEventContext<java.lang.Object> context)
A post-update hook.boolean
prePersist(EntityEventContext<java.lang.Object> context)
A pre-persist hook.boolean
preRemove(EntityEventContext<java.lang.Object> context)
A pre-remove hook.boolean
preUpdate(EntityEventContext<java.lang.Object> context)
A pre-update hook.void
process(io.micronaut.inject.BeanDefinition<?> beanDefinition, io.micronaut.inject.ExecutableMethod<?,?> method)
boolean
supports(RuntimePersistentEntity<java.lang.Object> entity, java.lang.Class<? extends java.lang.annotation.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, wait
-
Methods inherited from interface io.micronaut.data.event.EntityEventListener
preQuery
-
-
-
-
Method Detail
-
supports
public boolean supports(RuntimePersistentEntity<java.lang.Object> entity, java.lang.Class<? extends java.lang.annotation.Annotation> eventType)
Description copied from interface:EntityEventListener
Allows including or excluding a listener for a specific entity.- Specified by:
supports
in interfaceEntityEventListener<java.lang.Object>
- Parameters:
entity
- The entityeventType
- The event type- Returns:
- True if it is supported
-
prePersist
public boolean prePersist(@NonNull EntityEventContext<java.lang.Object> context)
Description copied from interface:EntityEventListener
A pre-persist hook. Implementors can return false to evict the operation.- Specified by:
prePersist
in interfaceEntityEventListener<java.lang.Object>
- Parameters:
context
- The context object- Returns:
- A boolean value indicating whether to proceed with the operation.
-
postPersist
public void postPersist(@NonNull EntityEventContext<java.lang.Object> context)
Description copied from interface:EntityEventListener
A post-persist hook. Executed once the object has been persisted.- Specified by:
postPersist
in interfaceEntityEventListener<java.lang.Object>
- Parameters:
context
- The context object
-
postLoad
public void postLoad(@NonNull EntityEventContext<java.lang.Object> context)
Description copied from interface:EntityEventListener
A post-load hook. Executed once the object has been persisted.- Specified by:
postLoad
in interfaceEntityEventListener<java.lang.Object>
- Parameters:
context
- The context object
-
preRemove
public boolean preRemove(@NonNull EntityEventContext<java.lang.Object> context)
Description copied from interface:EntityEventListener
A pre-remove hook. Implementors can return false to evict the operation.- Specified by:
preRemove
in interfaceEntityEventListener<java.lang.Object>
- Parameters:
context
- The context object- Returns:
- A boolean value indicating whether to proceed with the operation.
-
postRemove
public void postRemove(@NonNull EntityEventContext<java.lang.Object> context)
Description copied from interface:EntityEventListener
A post-remove hook. Executed once the object has been removed.- Specified by:
postRemove
in interfaceEntityEventListener<java.lang.Object>
- Parameters:
context
- The context object
-
preUpdate
public boolean preUpdate(@NonNull EntityEventContext<java.lang.Object> context)
Description copied from interface:EntityEventListener
A pre-update hook. Implementors can return false to evict the operation.- Specified by:
preUpdate
in interfaceEntityEventListener<java.lang.Object>
- Parameters:
context
- The context object- Returns:
- A boolean value indicating whether to proceed with the operation.
-
postUpdate
public void postUpdate(@NonNull EntityEventContext<java.lang.Object> context)
Description copied from interface:EntityEventListener
A post-update hook. Executed once the object has been updated.- Specified by:
postUpdate
in interfaceEntityEventListener<java.lang.Object>
- Parameters:
context
- The context object
-
process
public void process(io.micronaut.inject.BeanDefinition<?> beanDefinition, io.micronaut.inject.ExecutableMethod<?,?> method)
- Specified by:
process
in interfaceio.micronaut.context.processor.AnnotationProcessor<EntityEventMapping,io.micronaut.inject.ExecutableMethod<?,?>>
- Specified by:
process
in interfaceio.micronaut.context.processor.ExecutableMethodProcessor<EntityEventMapping>
-
-