java.lang.Object
java.lang.Record
com.github.sormuras.bach.ToolRun
- Record Components:
name
- the name of the toolargs
- the arguments of the tool runthread
- the ID of the thread that ran the toolduration
- the duration of the tool runcode
- the exit code of the tool runoutput
- the normal and expected output of the tool runerrors
- the error message of the tool run
public record ToolRun(String name, List<String> args, long thread, Duration duration, int code, String output, String errors)
extends Record
A record of a tool run.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A consumer of a tool run instance. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionargs()
Returns the value of theargs
record component.int
code()
Returns the value of thecode
record component.duration()
Returns the value of theduration
record component.final boolean
Indicates whether some other object is "equal to" this one.errors()
Returns the value of theerrors
record component.final int
hashCode()
Returns a hash code value for this object.boolean
isError()
Returnstrue
if this response represents an errored tool call run.boolean
Returnstrue
if this response represents a successful tool call run.name()
Returns the value of thename
record component.output()
Returns the value of theoutput
record component.Returns silently this instance if it represents a successful tool call run.long
thread()
Returns the value of thethread
record component.final String
toString()
Returns a string representation of this record class.visit
(ToolRun.Visitor visitor)
-
Constructor Details
-
ToolRun
public ToolRun(String name, List<String> args, long thread, Duration duration, int code, String output, String errors) Creates an instance of aToolRun
record class.- Parameters:
name
- the value for thename
record componentargs
- the value for theargs
record componentthread
- the value for thethread
record componentduration
- the value for theduration
record componentcode
- the value for thecode
record componentoutput
- the value for theoutput
record componenterrors
- the value for theerrors
record component
-
-
Method Details
-
isError
Returnstrue
if this response represents an errored tool call run.- Returns:
true
if this response represents an errored tool call run
-
isSuccessful
Returnstrue
if this response represents a successful tool call run.- Returns:
true
if this response represents a successful tool call run
-
requireSuccessful
Returns silently this instance if it represents a successful tool call run.- Returns:
- silently this instance if it represents a successful tool call run
- Throws:
RuntimeException
- ifisError()
returnstrue
-
visit
-
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
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 '=='. -
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
args
Returns the value of theargs
record component.- Returns:
- the value of the
args
record component
-
thread
Returns the value of thethread
record component.- Returns:
- the value of the
thread
record component
-
duration
Returns the value of theduration
record component.- Returns:
- the value of the
duration
record component
-
code
Returns the value of thecode
record component.- Returns:
- the value of the
code
record component
-
output
Returns the value of theoutput
record component.- Returns:
- the value of the
output
record component
-
errors
Returns the value of theerrors
record component.- Returns:
- the value of the
errors
record component
-