Package com.tnsai.coordination.handoff
Record Class HandoffContext
java.lang.Object
java.lang.Record
com.tnsai.coordination.handoff.HandoffContext
- Record Components:
taskId- unique identifier for the task being handed offpayload- data associated with the handoffmetadata- additional metadata (tracing, routing hints, etc.)parentHandoffId- optional parent handoff ID for chained handoffs
public record HandoffContext(String taskId, Map<String,Object> payload, Map<String,Object> metadata, String parentHandoffId)
extends Record
Immutable context passed through a handoff between agents.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.metadata()Returns the value of themetadatarecord component.static HandoffContextCreates a context with only a task ID.static HandoffContextCreates a context with a task ID and payload.Returns the value of theparentHandoffIdrecord component.payload()Returns the value of thepayloadrecord component.taskId()Returns the value of thetaskIdrecord component.final StringtoString()Returns a string representation of this record class.withPayload(String key, Object value) Returns a new context with an additional payload entry.
-
Constructor Details
-
HandoffContext
public HandoffContext(String taskId, Map<String, Object> payload, Map<String, Object> metadata, String parentHandoffId) Creates an instance of aHandoffContextrecord class.- Parameters:
taskId- the value for thetaskIdrecord componentpayload- the value for thepayloadrecord componentmetadata- the value for themetadatarecord componentparentHandoffId- the value for theparentHandoffIdrecord component
-
-
Method Details
-
of
Creates a context with only a task ID. -
of
Creates a context with a task ID and payload. -
withPayload
Returns a new context with an additional payload entry. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
taskId
Returns the value of thetaskIdrecord component.- Returns:
- the value of the
taskIdrecord component
-
payload
Returns the value of thepayloadrecord component.- Returns:
- the value of the
payloadrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-
parentHandoffId
Returns the value of theparentHandoffIdrecord component.- Returns:
- the value of the
parentHandoffIdrecord component
-