Module concord_core

Record Class Chat

java.lang.Object
java.lang.Record
nl.andrewl.concord_core.msg.types.chat.Chat
All Implemented Interfaces:
Message

public record Chat(UUID id, UUID senderId, String senderNickname, long timestamp, String message) extends Record implements Message
This message contains information about a chat message that a user sent.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final UUID
    The field for the id record component.
    private final String
    The field for the message record component.
    private final UUID
    The field for the senderId record component.
    private final String
    The field for the senderNickname record component.
    private final long
    The field for the timestamp record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Chat(String message)
     
    Chat(UUID senderId, String senderNickname, long timestamp, String message)
     
    Chat(UUID id, UUID senderId, String senderNickname, long timestamp, String message)
    Creates an instance of a Chat record class.
    Chat(UUID newId, Chat original)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    id()
    Returns the value of the id record component.
    Returns the value of the message record component.
    Returns the value of the senderId record component.
    Returns the value of the senderNickname record component.
    long
    Returns the value of the timestamp record component.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface nl.andrewl.concord_core.msg.Message

    byteSize, getTypeSerializer
  • Field Details

    • id

      private final UUID id
      The field for the id record component.
    • senderId

      private final UUID senderId
      The field for the senderId record component.
    • senderNickname

      private final String senderNickname
      The field for the senderNickname record component.
    • timestamp

      private final long timestamp
      The field for the timestamp record component.
    • message

      private final String message
      The field for the message record component.
  • Constructor Details

    • Chat

      public Chat(UUID senderId, String senderNickname, long timestamp, String message)
    • Chat

      public Chat(String message)
    • Chat

      public Chat(UUID newId, Chat original)
    • Chat

      public Chat(UUID id, UUID senderId, String senderNickname, long timestamp, String message)
      Creates an instance of a Chat record class.
      Parameters:
      id - the value for the id record component
      senderId - the value for the senderId record component
      senderNickname - the value for the senderNickname record component
      timestamp - the value for the timestamp record component
      message - the value for the message record component
  • Method Details

    • toString

      public 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
    • equals

      public 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • 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
    • id

      public UUID id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • senderId

      public UUID senderId()
      Returns the value of the senderId record component.
      Returns:
      the value of the senderId record component
    • senderNickname

      public String senderNickname()
      Returns the value of the senderNickname record component.
      Returns:
      the value of the senderNickname record component
    • timestamp

      public long timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component