Package com.tnsai.coordination.handoff
Record Class HandoffResult
java.lang.Object
java.lang.Record
com.tnsai.coordination.handoff.HandoffResult
- Record Components:
success- whether the handoff completed successfullyfromAgentId- the agent that initiated the handofftoAgentId- the agent that received the handoffdurationMs- wall-clock duration in millisecondsoutput- 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 Summary
ConstructorsConstructorDescriptionHandoffResult(boolean success, String fromAgentId, String toAgentId, long durationMs, Object output) Creates an instance of aHandoffResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of thedurationMsrecord component.final booleanIndicates whether some other object is "equal to" this one.static HandoffResultCreates a failed handoff result.Returns the value of thefromAgentIdrecord component.final inthashCode()Returns a hash code value for this object.output()Returns the value of theoutputrecord component.booleansuccess()Returns the value of thesuccessrecord component.static HandoffResultCreates a successful handoff result.Returns the value of thetoAgentIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
HandoffResult
public HandoffResult(boolean success, String fromAgentId, String toAgentId, long durationMs, Object output) Creates an instance of aHandoffResultrecord class.- Parameters:
success- the value for thesuccessrecord componentfromAgentId- the value for thefromAgentIdrecord componenttoAgentId- the value for thetoAgentIdrecord componentdurationMs- the value for thedurationMsrecord componentoutput- the value for theoutputrecord component
-
-
Method Details
-
success
Creates a successful handoff result. -
failure
Creates a failed handoff result. -
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 '=='. -
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
fromAgentId
Returns the value of thefromAgentIdrecord component.- Returns:
- the value of the
fromAgentIdrecord component
-
toAgentId
Returns the value of thetoAgentIdrecord component.- Returns:
- the value of the
toAgentIdrecord component
-
durationMs
public long durationMs()Returns the value of thedurationMsrecord component.- Returns:
- the value of the
durationMsrecord component
-
output
Returns the value of theoutputrecord component.- Returns:
- the value of the
outputrecord component
-