Class TraceOutcome.Builder

java.lang.Object
cs1302.tracer.api.TraceOutcome.Builder
Enclosing class:
TraceOutcome

@API(status=STABLE, since="4.1.0") public static final class TraceOutcome.Builder extends Object
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 Details

    • format

      public TraceOutcome.Builder format(String value)
      Sets the output format without parsing or validation.
      Parameters:
      value - Selected output format, possibly null.
      Returns:
      This builder.
    • status

      public TraceOutcome.Builder status(String value)
      Sets the status without deriving other outcome fields.
      Parameters:
      value - Outcome status, possibly null.
      Returns:
      This builder.
    • stopReason

      public TraceOutcome.Builder stopReason(String value)
      Sets the stop reason.
      Parameters:
      value - Machine-readable stop reason, possibly null.
      Returns:
      This builder.
    • phase

      public TraceOutcome.Builder phase(String value)
      Sets the last execution phase.
      Parameters:
      value - Execution phase, possibly null.
      Returns:
      This builder.
    • complete

      public TraceOutcome.Builder complete(boolean value)
      Sets completion without deriving status or serialized fields.
      Parameters:
      value - Whether the job completed.
      Returns:
      This builder.
    • counters

      public TraceOutcome.Builder counters(Map<String,Long> value)
      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

      public TraceOutcome.Builder diagnostics(List<String> value)
      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

      public TraceOutcome.Builder stdout(String value)
      Sets captured stdout without updating the supplied envelope JSON.
      Parameters:
      value - Captured guest output, possibly null.
      Returns:
      This builder.
    • stderr

      public TraceOutcome.Builder stderr(String value)
      Sets captured stderr without updating the supplied envelope JSON.
      Parameters:
      value - Captured guest error output, possibly null.
      Returns:
      This builder.
    • traceJson

      public TraceOutcome.Builder traceJson(String value)
      Sets the trace payload JSON verbatim without validation or envelope synchronization.
      Parameters:
      value - Serialized trace payload, possibly null.
      Returns:
      This builder.
    • json

      public TraceOutcome.Builder json(String value)
      Sets the result-envelope JSON verbatim without validating it or deriving metadata.
      Parameters:
      value - Serialized result envelope, possibly null.
      Returns:
      This builder.
    • build

      public TraceOutcome 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.