Record Class CapturedEvent
java.lang.Object
java.lang.Record
com.opencqrs.framework.persistence.CapturedEvent
- Record Components:
subject- the subject the event is going to be published toevent- the event object to be publishedmetaData- the event meta-data to be publishedpreconditions- the preconditions that must not be violated when publishing
public record CapturedEvent(@NotBlank String subject, @NotNull Object event, @NotNull Map<String,?> metaData, @NotNull List<Precondition> preconditions)
extends Record
Record capturing an event publication intent.
-
Constructor Summary
ConstructorsConstructorDescriptionCapturedEvent(@NotBlank String subject, @NotNull Object event, @NotNull Map<String, ?> metaData, @NotNull List<Precondition> preconditions) Creates an instance of aCapturedEventrecord class.CapturedEvent(String subject, Object event) Convenience constructor, if no meta-data or preconditions are needed. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.@NotNull Objectevent()Returns the value of theeventrecord component.final inthashCode()Returns a hash code value for this object.metaData()Returns the value of themetaDatarecord component.@NotNull List<Precondition> Returns the value of thepreconditionsrecord component.@NotBlank Stringsubject()Returns the value of thesubjectrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CapturedEvent
Convenience constructor, if no meta-data or preconditions are needed.- Parameters:
subject- the subject the event is going to be published toevent- the event object to be published
-
CapturedEvent
public CapturedEvent(@NotBlank @NotBlank String subject, @NotNull @NotNull Object event, @NotNull @NotNull Map<String, ?> metaData, @NotNull @NotNull List<Precondition> preconditions) Creates an instance of aCapturedEventrecord class.- Parameters:
subject- the value for thesubjectrecord componentevent- the value for theeventrecord componentmetaData- the value for themetaDatarecord componentpreconditions- the value for thepreconditionsrecord component
-
-
Method Details
-
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. -
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. -
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). -
subject
Returns the value of thesubjectrecord component.- Returns:
- the value of the
subjectrecord component
-
event
Returns the value of theeventrecord component.- Returns:
- the value of the
eventrecord component
-
metaData
Returns the value of themetaDatarecord component.- Returns:
- the value of the
metaDatarecord component
-
preconditions
Returns the value of thepreconditionsrecord component.- Returns:
- the value of the
preconditionsrecord component
-