Record Class DistributedTopic.TopicMessage<T>
java.lang.Object
java.lang.Record
com.loomcache.server.topic.DistributedTopic.TopicMessage<T>
- Type Parameters:
T- The message type
- Enclosing class:
DistributedTopic<T>
-
Constructor Summary
ConstructorsConstructorDescriptionTopicMessage(long sequence, long timestamp, T payload, String publisherId) Validate that sequence is positive and timestamp is non-negative. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.payload()Returns the value of thepayloadrecord component.Returns the value of thepublisherIdrecord component.longsequence()Returns the value of thesequencerecord component.longReturns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TopicMessage
Validate that sequence is positive and timestamp is non-negative.- Throws:
IllegalArgumentException- if sequence invalid input: '<'= 0 or timestamp invalid input: '<' 0
-
-
Method Details
-
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
public long sequence()Returns the value of thesequencerecord component.- Returns:
- the value of the
sequencerecord component
-
timestamp
public long timestamp()Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-
payload
Returns the value of thepayloadrecord component.- Returns:
- the value of the
payloadrecord component
-
publisherId
Returns the value of thepublisherIdrecord component.- Returns:
- the value of the
publisherIdrecord component
-