Record Class InvocationResult

java.lang.Object
java.lang.Record
org.j7m.middleware.transport.api.InvocationResult
Record Components:
value - logical value, possibly null; discarded when failure is present
failure - application or policy failure, null for success
diagnostics - trusted protocol status set by a registered host finalizer, never copied from application throwables

public record InvocationResult(Object value, Throwable failure, Map<String,String> diagnostics) extends Record
Host-local logical outcome passed only to trusted result finalizers, never serialized. Diagnostic rendering excludes application values and exception text.
  • Constructor Details

    • InvocationResult

      public InvocationResult(Object value, Throwable failure)
      Preserves the outcome constructor with no trusted protocol diagnostics.
      Parameters:
      value - logical result
      failure - logical failure, nullable
    • InvocationResult

      public InvocationResult(Object value, Throwable failure, Map<String,String> diagnostics)
      Creates an outcome without retaining a value alongside a failure.
  • Method Details

    • success

      public static InvocationResult success(Object value)
      Creates a successful logical result.
      Parameters:
      value - result, possibly null
      Returns:
      successful host outcome
    • failure

      public static InvocationResult failure(Throwable failure)
      Creates a failed logical result without evaluating application exception methods.
      Parameters:
      failure - non-null failure
      Returns:
      failed host outcome
    • toString

      public String toString()
      Returns a payload-free diagnostic form.
      Specified by:
      toString in class Record
      Returns:
      success/failure classification only
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • value

      public Object value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • failure

      public Throwable failure()
      Returns the value of the failure record component.
      Returns:
      the value of the failure record component
    • diagnostics

      public Map<String,String> diagnostics()
      Returns the value of the diagnostics record component.
      Returns:
      the value of the diagnostics record component