Record Class HandoffResult

java.lang.Object
java.lang.Record
com.tnsai.coordination.handoff.HandoffResult
Record Components:
success - whether the handoff completed successfully
fromAgentId - the agent that initiated the handoff
toAgentId - the agent that received the handoff
durationMs - wall-clock duration in milliseconds
output - the result produced by the receiving agent (null on failure)

public record HandoffResult(boolean success, String fromAgentId, String toAgentId, long durationMs, Object output) extends Record
Immutable result of a handoff operation.
  • Constructor Details

    • HandoffResult

      public HandoffResult(boolean success, String fromAgentId, String toAgentId, long durationMs, Object output)
      Creates an instance of a HandoffResult record class.
      Parameters:
      success - the value for the success record component
      fromAgentId - the value for the fromAgentId record component
      toAgentId - the value for the toAgentId record component
      durationMs - the value for the durationMs record component
      output - the value for the output record component
  • Method Details

    • success

      public static HandoffResult success(String from, String to, long durationMs, Object output)
      Creates a successful handoff result.
    • failure

      public static HandoffResult failure(String from, String to, long durationMs)
      Creates a failed handoff result.
    • 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. 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.
    • success

      public boolean success()
      Returns the value of the success record component.
      Returns:
      the value of the success record component
    • fromAgentId

      public String fromAgentId()
      Returns the value of the fromAgentId record component.
      Returns:
      the value of the fromAgentId record component
    • toAgentId

      public String toAgentId()
      Returns the value of the toAgentId record component.
      Returns:
      the value of the toAgentId record component
    • durationMs

      public long durationMs()
      Returns the value of the durationMs record component.
      Returns:
      the value of the durationMs record component
    • output

      public Object output()
      Returns the value of the output record component.
      Returns:
      the value of the output record component