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 aCapturedEvent
record class.CapturedEvent
(String subject, Object event) Convenience constructor, if no meta-data or preconditions are needed. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.@NotNull Object
event()
Returns the value of theevent
record component.final int
hashCode()
Returns a hash code value for this object.metaData()
Returns the value of themetaData
record component.@NotNull List
<Precondition> Returns the value of thepreconditions
record component.@NotBlank String
subject()
Returns the value of thesubject
record component.final String
toString()
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 aCapturedEvent
record class.- Parameters:
subject
- the value for thesubject
record componentevent
- the value for theevent
record componentmetaData
- the value for themetaData
record componentpreconditions
- the value for thepreconditions
record 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 thesubject
record component.- Returns:
- the value of the
subject
record component
-
event
Returns the value of theevent
record component.- Returns:
- the value of the
event
record component
-
metaData
Returns the value of themetaData
record component.- Returns:
- the value of the
metaData
record component
-
preconditions
Returns the value of thepreconditions
record component.- Returns:
- the value of the
preconditions
record component
-