Record Class MessageContext<T extends ChannelPayload>
java.lang.Object
java.lang.Record
dev.objz.commandbridge.api.message.MessageContext<T>
- Type Parameters:
T- the payload type of the channel this message was received on; bounded byChannelPayload- Record Components:
channel- theClasstoken of the payload type, identifying which channel this message was received onfrom- thePlatform.ServerTargetidentifying the server that sent the messagetimestamp- the time at which the message was sent, in milliseconds since the Unix epoch
public record MessageContext<T extends ChannelPayload>(Class<T extends ChannelPayload> channel, Platform.ServerTarget from, long timestamp)
extends Record
Metadata accompanying a message received on a
MessageChannel.
channel is the payload class token identifying the channel the
message arrived on.
from identifies the server that sent the message.
timestamp is the Unix epoch millisecond value when the message was
sent.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMessageContext(Class<T> channel, Platform.ServerTarget from, long timestamp) Creates an instance of aMessageContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionchannel()Returns the value of thechannelrecord component.final booleanIndicates whether some other object is "equal to" this one.from()Returns the value of thefromrecord component.final inthashCode()Returns a hash code value for this object.longReturns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
channel
Returns the value of thechannelrecord component.- Returns:
- the value of the
channelrecord component
-
from
Returns the value of thefromrecord component.- Returns:
- the value of the
fromrecord component
-
timestamp
public long timestamp()Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-