Record Class CliState

java.lang.Object
java.lang.Record
ai.mindconnect.cli.CliState

public record CliState(CliState.View view, UUID lastAgentId, UUID lastSessionId) extends Record
Persisted "where the user was" between CLI runs. Written at three points: when the user enters the session menu, when a session becomes active, and when the user returns to the agent list. Read once at startup and used to jump straight back into the previous view.
  • Constructor Details

    • CliState

      public CliState(CliState.View view, UUID lastAgentId, UUID lastSessionId)
      Creates an instance of a CliState record class.
      Parameters:
      view - the value for the view record component
      lastAgentId - the value for the lastAgentId record component
      lastSessionId - the value for the lastSessionId record component
  • Method Details

    • fromJson

      public static CliState fromJson(CliState.View view, UUID lastAgentId, UUID lastSessionId)
    • empty

      public static CliState empty()
    • agentList

      public static CliState agentList()
    • sessionList

      public static CliState sessionList(UUID agentId)
    • activeSession

      public static CliState activeSession(UUID agentId, UUID sessionId)
    • 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.
    • view

      public CliState.View view()
      Returns the value of the view record component.
      Returns:
      the value of the view record component
    • lastAgentId

      public UUID lastAgentId()
      Returns the value of the lastAgentId record component.
      Returns:
      the value of the lastAgentId record component
    • lastSessionId

      public UUID lastSessionId()
      Returns the value of the lastSessionId record component.
      Returns:
      the value of the lastSessionId record component