Record Class HierarchyResult
java.lang.Object
java.lang.Record
com.tnsai.coordination.groups.hierarchy.HierarchyResult
- Record Components:
taskId- task identifiersuccess- whether the operation succeededoutput- final outputdelegationPath- agents involved in the delegation chainstartedAt- start timecompletedAt- completion timeerror- error message if failed
public record HierarchyResult(String taskId, boolean success, String output, List<String> delegationPath, Instant startedAt, Instant completedAt, String error)
extends Record
Result of a hierarchy delegation or escalation operation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecompletedAtrecord component.Returns the value of thedelegationPathrecord component.final booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.static HierarchyResultCreates a failed result.Gets execution duration.final inthashCode()Returns a hash code value for this object.output()Returns the value of theoutputrecord component.Returns the value of thestartedAtrecord component.booleansuccess()Returns the value of thesuccessrecord component.static HierarchyResultCreates a successful result.taskId()Returns the value of thetaskIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
HierarchyResult
public HierarchyResult(String taskId, boolean success, String output, List<String> delegationPath, Instant startedAt, Instant completedAt, String error) Creates an instance of aHierarchyResultrecord class.- Parameters:
taskId- the value for thetaskIdrecord componentsuccess- the value for thesuccessrecord componentoutput- the value for theoutputrecord componentdelegationPath- the value for thedelegationPathrecord componentstartedAt- the value for thestartedAtrecord componentcompletedAt- the value for thecompletedAtrecord componenterror- the value for theerrorrecord component
-
-
Method Details
-
success
public static HierarchyResult success(String taskId, String output, List<String> delegationPath, Instant startedAt) Creates a successful result.- Parameters:
taskId- task IDoutput- outputdelegationPath- delegation pathstartedAt- start time- Returns:
- successful result
-
failure
public static HierarchyResult failure(String taskId, String error, List<String> delegationPath, Instant startedAt) Creates a failed result.- Parameters:
taskId- task IDerror- error messagedelegationPath- partial delegation pathstartedAt- start time- Returns:
- failed result
-
getDuration
Gets execution duration.- Returns:
- duration
-
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 '=='. -
taskId
Returns the value of thetaskIdrecord component.- Returns:
- the value of the
taskIdrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
output
Returns the value of theoutputrecord component.- Returns:
- the value of the
outputrecord component
-
delegationPath
Returns the value of thedelegationPathrecord component.- Returns:
- the value of the
delegationPathrecord component
-
startedAt
Returns the value of thestartedAtrecord component.- Returns:
- the value of the
startedAtrecord component
-
completedAt
Returns the value of thecompletedAtrecord component.- Returns:
- the value of the
completedAtrecord component
-
error
Returns the value of theerrorrecord component.- Returns:
- the value of the
errorrecord component
-