Record Class JournalEntry
java.lang.Object
java.lang.Record
com.loomcache.server.journal.JournalEntry
- Record Components:
sequence- Monotonically increasing sequence numbertimestamp- Event creation time in nanosecondseventType- Type classifier for the eventkey- Key associated with the event (may be null)payload- Event payload as bytes (may be empty)metadata- Optional metadata (never null, may be empty)
public record JournalEntry(long sequence, long timestamp, String eventType, String key, byte[] payload, Map<String,String> metadata)
extends Record
Represents a single entry in the distributed event journal.
Each entry is immutable and contains:
- sequence: Monotonically increasing identifier
- timestamp: Creation time in nanoseconds
- eventType: Type classifier for the event
- key: Associated key (may be null)
- payload: Event data as bytes
- metadata: Optional key-value pairs
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theeventTyperecord component.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.metadata()Returns the value of themetadatarecord component.byte[]payload()Returns the value of thepayloadrecord component.longsequence()Returns the value of thesequencerecord component.longReturns the value of thetimestamprecord component.toString()Compact representation for logging and debugging.
-
Constructor Details
-
JournalEntry
public JournalEntry(long sequence, long timestamp, String eventType, String key, byte[] payload, Map<String, String> metadata) Creates an instance of aJournalEntryrecord class.- Parameters:
sequence- the value for thesequencerecord componenttimestamp- the value for thetimestamprecord componenteventType- the value for theeventTyperecord componentkey- the value for thekeyrecord componentpayload- the value for thepayloadrecord componentmetadata- the value for themetadatarecord component
-
-
Method Details
-
payload
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
sequence
-
timestamp
-
eventType
-
key
-
metadata
-