Package io.umadb.client
Record Class Event
java.lang.Object
java.lang.Record
io.umadb.client.Event
Represents a single immutable event.
An event consists of a type identifier, one or more tags for classification or querying, an opaque binary payload, and a unique event identifier.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]data()Returns the value of thedatarecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.static EventCreates a newEventwith a generated identifier and a single tag.static EventCreates a newEventwith a generated identifier.tags()Returns the value of thetagsrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.static EventCreates a newEventwith the given identifier.Returns a copy of this event with a different identifier.
-
Constructor Details
-
Event
Creates a newEvent.- Throws:
IllegalArgumentException- if validation constraints are violated
-
-
Method Details
-
of
Creates a newEventwith a generated identifier.- Parameters:
type- the event typetags- the event tags (must contain at least one element)data- the event payload- Returns:
- a new
Eventwith a random UUID
-
of
Creates a newEventwith a generated identifier and a single tag.- Parameters:
type- the event typetag- the single event tagdata- the event payload- Returns:
- a new
Eventwith a random UUID
-
withId
Creates a newEventwith the given identifier.This factory is useful when events are reconstructed from persisted storage or received from a remote source.
- Parameters:
type- the event typetags- the event tagsdata- the event payloadid- the event identifier- Returns:
- a new
Event
-
withId
Returns a copy of this event with a different identifier.- Parameters:
id- the new event identifier- Returns:
- a new
Eventwith the given identifier
-
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). -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
tags
Returns the value of thetagsrecord component.- Returns:
- the value of the
tagsrecord component
-
data
public byte[] data()Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-