Package io.micronaut.data.event
Interface EntityEventListener<T>
- Type Parameters:
- T- the entity type
- All Superinterfaces:
- EventListener,- io.micronaut.core.order.Ordered
- All Known Subinterfaces:
- PostPersistEventListener<T>,- PostRemoveEventListener<T>,- PostUpdateEventListener<T>,- PrePersistEventListener<T>,- PreRemoveEventListener<T>,- PreUpdateEventListener<T>
- All Known Implementing Classes:
- AnnotatedMethodInvokingEntityEventListener,- AutoPopulatedEntityEventListener,- AutoTimestampEntityEventListener,- EntityEventRegistry,- UUIDGeneratingEntityEventListener,- VersionGeneratingEntityEventListener
@Indexed(EntityEventListener.class)
public interface EntityEventListener<T>
extends EventListener, io.micronaut.core.order.Ordered
The interface representing an entity event listener.
 
Event listeners are able to listen for persistence events through the various method hooks provided.
 The supports(RuntimePersistentEntity, Class) method can be used to narrow applicable entities and
 should be called by implementors prior to invoking one of the event methods.
Note that EntityEventListener added by the user SHOULD NOT be annotated with Primary.
- Since:
- 2.3.0
- Author:
- graemerocher, Denis Stepanov
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final EntityEventListener<Object>A no-op event listener that does nothing.Fields inherited from interface io.micronaut.core.order.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Method SummaryModifier and TypeMethodDescriptiondefault voidpostLoad(@NonNull EntityEventContext<T> context) A post-load hook.default voidpostPersist(@NonNull EntityEventContext<T> context) A post-persist hook.default voidpostRemove(@NonNull EntityEventContext<T> context) A post-remove hook.default voidpostUpdate(@NonNull EntityEventContext<T> context) A post-update hook.default booleanprePersist(@NonNull EntityEventContext<T> context) A pre-persist hook.default booleanpreQuery(@NonNull QueryEventContext<T> context) A pre-update hook.default booleanpreRemove(@NonNull EntityEventContext<T> context) A pre-remove hook.default booleanpreUpdate(@NonNull EntityEventContext<T> context) A pre-update hook.default booleansupports(RuntimePersistentEntity<T> entity, Class<? extends Annotation> eventType) Allows including or excluding a listener for a specific entity.Methods inherited from interface io.micronaut.core.order.OrderedgetOrder
- 
Field Details- 
NOOPA no-op event listener that does nothing.
 
- 
- 
Method Details- 
supportsAllows including or excluding a listener for a specific entity.- Parameters:
- entity- The entity
- eventType- The event type
- Returns:
- True if it is supported
 
- 
prePersistA pre-persist hook. Implementors can return false to evict the operation.- Parameters:
- context- The context object
- Returns:
- A boolean value indicating whether to proceed with the operation.
 
- 
postPersistA post-persist hook. Executed once the object has been persisted.- Parameters:
- context- The context object
 
- 
postLoadA post-load hook. Executed once the object has been persisted.- Parameters:
- context- The context object
 
- 
preRemoveA pre-remove hook. Implementors can return false to evict the operation.- Parameters:
- context- The context object
- Returns:
- A boolean value indicating whether to proceed with the operation.
 
- 
postRemoveA post-remove hook. Executed once the object has been removed.- Parameters:
- context- The context object
 
- 
preUpdateA pre-update hook. Implementors can return false to evict the operation.- Parameters:
- context- The context object
- Returns:
- A boolean value indicating whether to proceed with the operation.
 
- 
preQueryA pre-update hook. Implementors can return false to evict the operation.- Parameters:
- context- The context object
- Returns:
- A boolean value indicating whether to proceed with the operation.
 
- 
postUpdateA post-update hook. Executed once the object has been updated.- Parameters:
- context- The context object
 
 
-