Interface ChangeEvent<E>

Type Parameters:
E - The persistent entity type.
All Known Implementing Classes:
DefaultChangeEvent, DeferredChangeEvent

public interface ChangeEvent<E>
A database change or subscription lifecycle notification for a persistent entity type.

Entity state is optional. A provider may load it after the change has committed, so it is not necessarily a snapshot of the row at the time of the change. An event that does not identify one row, such as an invalidation or subscription termination, has no single entity associated with it.

Since:
5.3.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the entity state associated with this event, when it is available.
    metadata(Class<M> metadataType)
    Finds provider-specific metadata of the requested type.
    Returns the operation reported by the notification provider.
  • Method Details

    • operation

      ChangeOperation operation()
      Returns the operation reported by the notification provider.
      Returns:
      The reported change operation.
    • entity

      Optional<E> entity()
      Returns the entity state associated with this event, when it is available.
      Returns:
      The entity, or empty when the provider has no entity state for this event.
    • metadata

      <M extends ChangeEventMetadata> Optional<M> metadata(Class<M> metadataType)
      Finds provider-specific metadata of the requested type.
      Type Parameters:
      M - The metadata type.
      Parameters:
      metadataType - The metadata type.
      Returns:
      The metadata when this event contains the requested type.