Package cs1302.tracer.api
Class TraceOutcome.Builder
java.lang.Object
cs1302.tracer.api.TraceOutcome.Builder
- Enclosing class:
TraceOutcome
Mutable, reusable construction of explicitly supplied outcome values; not thread-safe.
Collection setters take shallow immutable copies and reject null collections or entries.
Strings may be null, matching the canonical constructor. Changing this builder does not
change a previously built outcome.
This builder does not generate JSON, validate JSON, or synchronize metadata with the supplied JSON strings. Production trace rendering supplies those values from one execution result. Callers constructing or adapting outcomes are responsible for their consistency.
- Since:
- 4.1.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a detached outcome using the existing canonical constructor.complete(boolean value) Sets completion without deriving status or serialized fields.Takes a shallow immutable copy of the resource counters.diagnostics(List<String> value) Takes a shallow immutable copy of the diagnostics in their supplied order.Sets the output format without parsing or validation.Sets the result-envelope JSON verbatim without validating it or deriving metadata.Sets the last execution phase.Sets the status without deriving other outcome fields.Sets captured stderr without updating the supplied envelope JSON.Sets captured stdout without updating the supplied envelope JSON.stopReason(String value) Sets the stop reason.Sets the trace payload JSON verbatim without validation or envelope synchronization.
-
Method Details
-
format
Sets the output format without parsing or validation.- Parameters:
value- Selected output format, possibly null.- Returns:
- This builder.
-
status
Sets the status without deriving other outcome fields.- Parameters:
value- Outcome status, possibly null.- Returns:
- This builder.
-
stopReason
Sets the stop reason.- Parameters:
value- Machine-readable stop reason, possibly null.- Returns:
- This builder.
-
phase
Sets the last execution phase.- Parameters:
value- Execution phase, possibly null.- Returns:
- This builder.
-
complete
Sets completion without deriving status or serialized fields.- Parameters:
value- Whether the job completed.- Returns:
- This builder.
-
counters
Takes a shallow immutable copy of the resource counters.- Parameters:
value- Resource accounting.- Returns:
- This builder.
- Throws:
NullPointerException- If the map, a key, or a value is null.
-
diagnostics
Takes a shallow immutable copy of the diagnostics in their supplied order.- Parameters:
value- Job diagnostics.- Returns:
- This builder.
- Throws:
NullPointerException- If the list or an entry is null.
-
stdout
Sets captured stdout without updating the supplied envelope JSON.- Parameters:
value- Captured guest output, possibly null.- Returns:
- This builder.
-
stderr
Sets captured stderr without updating the supplied envelope JSON.- Parameters:
value- Captured guest error output, possibly null.- Returns:
- This builder.
-
traceJson
Sets the trace payload JSON verbatim without validation or envelope synchronization.- Parameters:
value- Serialized trace payload, possibly null.- Returns:
- This builder.
-
json
Sets the result-envelope JSON verbatim without validating it or deriving metadata.- Parameters:
value- Serialized result envelope, possibly null.- Returns:
- This builder.
-
build
Creates a detached outcome using the existing canonical constructor. No JSON parsing, generation, or consistency validation occurs.- Returns:
- A new outcome with this builder's values.
-