Record Class SessionRecord

java.lang.Object
java.lang.Record
io.github.protasm.jvmud.engine.identity.SessionRecord

public record SessionRecord(SessionId id, PlayerId playerId, Optional<String> remoteAddress, Instant connectedAt, Instant lastActivityAt, Optional<PersonaId> attachedPersonaId) extends Record
Engine-owned record for a connection and transport context.

A Session is bound to a Player as soon as the connection is known. It may remain unattached to any Persona during login, reconnect, or character selection.

  • Constructor Details

    • SessionRecord

      public SessionRecord(SessionId id, PlayerId playerId, Optional<String> remoteAddress, Instant connectedAt, Instant lastActivityAt, Optional<PersonaId> attachedPersonaId)
      Creates an instance of a SessionRecord record class.
      Parameters:
      id - the value for the id record component
      playerId - the value for the playerId record component
      remoteAddress - the value for the remoteAddress record component
      connectedAt - the value for the connectedAt record component
      lastActivityAt - the value for the lastActivityAt record component
      attachedPersonaId - the value for the attachedPersonaId record component
    • SessionRecord

      public SessionRecord(SessionId id, PlayerId playerId, Optional<String> remoteAddress, Instant connectedAt)
  • Method Details

    • toString

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

      public final 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • id

      public SessionId id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • playerId

      public PlayerId playerId()
      Returns the value of the playerId record component.
      Returns:
      the value of the playerId record component
    • remoteAddress

      public Optional<String> remoteAddress()
      Returns the value of the remoteAddress record component.
      Returns:
      the value of the remoteAddress record component
    • connectedAt

      public Instant connectedAt()
      Returns the value of the connectedAt record component.
      Returns:
      the value of the connectedAt record component
    • lastActivityAt

      public Instant lastActivityAt()
      Returns the value of the lastActivityAt record component.
      Returns:
      the value of the lastActivityAt record component
    • attachedPersonaId

      public Optional<PersonaId> attachedPersonaId()
      Returns the value of the attachedPersonaId record component.
      Returns:
      the value of the attachedPersonaId record component