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, ornullwhen no entity state is available.metadata- Provider-specific event metadata, ornullwhen 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 Summary
ConstructorsConstructorDescriptionDefaultChangeEvent(ChangeOperation operation, @Nullable E entityValue, @Nullable ChangeEventMetadata metadata) Creates a change event. -
Method Summary
Modifier and TypeMethodDescriptionentity()Returns the entity state associated with this event, when it is available.@Nullable EReturns the value of theentityValuerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable ChangeEventMetadatametadata()Returns the value of themetadatarecord component.<M extends ChangeEventMetadata>
Optional<M> Finds provider-specific metadata of the requested type.Returns the value of theoperationrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
DefaultChangeEvent
public DefaultChangeEvent(ChangeOperation operation, @Nullable E entityValue, @Nullable ChangeEventMetadata metadata) Creates a change event.- Throws:
NullPointerException- if the operation isnull
-
-
Method Details
-
entity
Description copied from interface:ChangeEventReturns the entity state associated with this event, when it is available.- Specified by:
entityin interfaceChangeEvent<E>- Returns:
- The entity, or empty when the provider has no entity state for this event.
-
metadata
Description copied from interface:ChangeEventFinds provider-specific metadata of the requested type.- Specified by:
metadatain interfaceChangeEvent<E>- Type Parameters:
M- The metadata type.- Parameters:
metadataType- The metadata type.- Returns:
- The metadata when this event contains the requested type.
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
operation
Returns the value of theoperationrecord component.- Specified by:
operationin interfaceChangeEvent<E>- Returns:
- the value of the
operationrecord component
-
entityValue
Returns the value of theentityValuerecord component.- Returns:
- the value of the
entityValuerecord component
-
metadata
-