Record Class DefaultChangeEvent<E>

java.lang.Object
java.lang.Record
io.micronaut.data.jdbc.notification.DefaultChangeEvent<E>
Type Parameters:
E - The persistent entity type.
Record Components:
operation - The operation reported by the notification provider.
entityValue - The reloaded entity, or null when no entity state is available.
metadata - Provider-specific event metadata, or null when none is available.
All Implemented Interfaces:
ChangeEvent<E>

@Internal public record DefaultChangeEvent<E>(ChangeOperation operation, @Nullable E entityValue, @Nullable ChangeEventMetadata metadata) extends Record implements ChangeEvent<E>
Default change-event implementation used by providers when entity state is already available or intentionally unavailable.
  • Constructor Details

  • Method Details

    • entity

      public Optional<E> entity()
      Description copied from interface: ChangeEvent
      Returns the entity state associated with this event, when it is available.
      Specified by:
      entity in interface ChangeEvent<E>
      Returns:
      The entity, or empty when the provider has no entity state for this event.
    • metadata

      public <M extends ChangeEventMetadata> Optional<M> metadata(Class<M> metadataType)
      Description copied from interface: ChangeEvent
      Finds provider-specific metadata of the requested type.
      Specified by:
      metadata in interface ChangeEvent<E>
      Type Parameters:
      M - The metadata type.
      Parameters:
      metadataType - The metadata type.
      Returns:
      The metadata when this event contains the requested type.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • operation

      public ChangeOperation operation()
      Returns the value of the operation record component.
      Specified by:
      operation in interface ChangeEvent<E>
      Returns:
      the value of the operation record component
    • entityValue

      public @Nullable E entityValue()
      Returns the value of the entityValue record component.
      Returns:
      the value of the entityValue record component
    • metadata

      public @Nullable ChangeEventMetadata metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component