Record Class Event

java.lang.Object
java.lang.Record
com.opencqrs.esdb.client.Event
Record Components:
source - identifies the originating source of publication
subject - an absolute path identifying the subject that the event is related to
type - uniquely identifies the event type, specifically for being able to interpret the contained data structure
data - a generic map structure containing the event payload
specVersion - cloud events specification version
id - a unique event identifier with respect to the originating event store
time - the publication time-stamp
dataContentType - the data content-type, always application/json
hash - the hash of this event
predecessorHash - the hash of the preceding event in the event store
All Implemented Interfaces:
Marshaller.ResponseElement

public record Event(@NotBlank String source, @NotBlank String subject, @NotBlank String type, @NotNull Map<String,?> data, @NotBlank String specVersion, @NotBlank String id, @NotNull Instant time, @NotBlank String dataContentType, String hash, @NotBlank String predecessorHash) extends Record implements Marshaller.ResponseElement
Event data structure retrieved from an event store, conforming to the Cloud Events Specification.
See Also:
  • Constructor Details

    • Event

      public Event(@NotBlank @NotBlank String source, @NotBlank @NotBlank String subject, @NotBlank @NotBlank String type, @NotNull @NotNull Map<String,?> data, @NotBlank @NotBlank String specVersion, @NotBlank @NotBlank String id, @NotNull @NotNull Instant time, @NotBlank @NotBlank String dataContentType, String hash, @NotBlank @NotBlank String predecessorHash)
      Creates an instance of a Event record class.
      Parameters:
      source - the value for the source record component
      subject - the value for the subject record component
      type - the value for the type record component
      data - the value for the data record component
      specVersion - the value for the specVersion record component
      id - the value for the id record component
      time - the value for the time record component
      dataContentType - the value for the dataContentType record component
      hash - the value for the hash record component
      predecessorHash - the value for the predecessorHash record component
  • Method Details

    • 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.
    • source

      @NotBlank public @NotBlank String source()
      Returns the value of the source record component.
      Returns:
      the value of the source record component
    • subject

      @NotBlank public @NotBlank String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • type

      @NotBlank public @NotBlank String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • data

      @NotNull public @NotNull Map<String,?> data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component
    • specVersion

      @NotBlank public @NotBlank String specVersion()
      Returns the value of the specVersion record component.
      Returns:
      the value of the specVersion record component
    • id

      @NotBlank public @NotBlank String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • time

      @NotNull public @NotNull Instant time()
      Returns the value of the time record component.
      Returns:
      the value of the time record component
    • dataContentType

      @NotBlank public @NotBlank String dataContentType()
      Returns the value of the dataContentType record component.
      Returns:
      the value of the dataContentType record component
    • hash

      public String hash()
      Returns the value of the hash record component.
      Returns:
      the value of the hash record component
    • predecessorHash

      @NotBlank public @NotBlank String predecessorHash()
      Returns the value of the predecessorHash record component.
      Returns:
      the value of the predecessorHash record component