Interface PrePersistEventListener<T>

Type Parameters:
T - The entity type
All Superinterfaces:
EntityEventListener<T>, EventListener, io.micronaut.core.order.Ordered
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PrePersistEventListener<T> extends EntityEventListener<T>
Functional version or PrePersist event handlers.
Since:
2.3.0
Author:
graemerocher
  • Method Details

    • prePersist

      boolean prePersist(@NonNull T entity)
      A pre-persist hook. Implementors can return false to evict the operation.
      Parameters:
      entity - The entity
      Returns:
      A boolean value indicating whether to proceed with the operation.
    • prePersist

      default boolean prePersist(@NonNull @NonNull EntityEventContext<T> context)
      Description copied from interface: EntityEventListener
      A pre-persist hook. Implementors can return false to evict the operation.
      Specified by:
      prePersist in interface EntityEventListener<T>
      Parameters:
      context - The context object
      Returns:
      A boolean value indicating whether to proceed with the operation.
    • supports

      default boolean supports(RuntimePersistentEntity<T> entity, Class<? extends Annotation> eventType)
      Description copied from interface: EntityEventListener
      Allows including or excluding a listener for a specific entity.
      Specified by:
      supports in interface EntityEventListener<T>
      Parameters:
      entity - The entity
      eventType - The event type
      Returns:
      True if it is supported