Record Class DiagnosticResult

java.lang.Object
java.lang.Record
dev.ua.theroer.magicutils.diagnostics.DiagnosticResult
Record Components:
checkId - check identifier
suite - suite identifier
status - result status
severity - failure importance
message - human-readable message
duration - measured duration
details - structured details
error - captured error, when present

public record DiagnosticResult(String checkId, String suite, DiagnosticStatus status, DiagnosticSeverity severity, String message, Duration duration, Map<String,Object> details, @Nullable Throwable error) extends Record
Result of a single diagnostic check.
  • Constructor Details

    • DiagnosticResult

      public DiagnosticResult(String checkId, String suite, DiagnosticStatus status, DiagnosticSeverity severity, String message, Duration duration, Map<String,Object> details, @Nullable @Nullable Throwable error)
      Creates a normalized result record.
      Parameters:
      checkId - check identifier
      suite - suite identifier
      status - result status
      severity - failure importance
      message - human-readable message
      duration - measured duration
      details - structured details
      error - captured error, when present
  • Method Details

    • ok

      public static DiagnosticResult ok(String checkId, String suite, DiagnosticSeverity severity, String message, Map<String,Object> details)
      Creates an OK result.
      Parameters:
      checkId - check identifier
      suite - suite identifier
      severity - failure importance
      message - result message
      details - structured details
      Returns:
      OK result
    • warn

      public static DiagnosticResult warn(String checkId, String suite, DiagnosticSeverity severity, String message, Map<String,Object> details)
      Creates a WARN result.
      Parameters:
      checkId - check identifier
      suite - suite identifier
      severity - failure importance
      message - result message
      details - structured details
      Returns:
      WARN result
    • fail

      public static DiagnosticResult fail(String checkId, String suite, DiagnosticSeverity severity, String message, Map<String,Object> details, @Nullable @Nullable Throwable error)
      Creates a FAIL result.
      Parameters:
      checkId - check identifier
      suite - suite identifier
      severity - failure importance
      message - result message
      details - structured details
      error - captured error
      Returns:
      FAIL result
    • skipped

      public static DiagnosticResult skipped(String checkId, String suite, DiagnosticSeverity severity, String message, Map<String,Object> details)
      Creates a SKIPPED result.
      Parameters:
      checkId - check identifier
      suite - suite identifier
      severity - failure importance
      message - result message
      details - structured details
      Returns:
      SKIPPED result
    • withDuration

      public DiagnosticResult withDuration(Duration duration)
      Returns a copy with the measured duration attached.
      Parameters:
      duration - measured duration
      Returns:
      updated result
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
    • checkId

      public String checkId()
      Returns the value of the checkId record component.
      Returns:
      the value of the checkId record component
    • suite

      public String suite()
      Returns the value of the suite record component.
      Returns:
      the value of the suite record component
    • status

      public DiagnosticStatus status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • severity

      public DiagnosticSeverity severity()
      Returns the value of the severity record component.
      Returns:
      the value of the severity record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • duration

      public Duration duration()
      Returns the value of the duration record component.
      Returns:
      the value of the duration record component
    • details

      public Map<String,Object> details()
      Returns the value of the details record component.
      Returns:
      the value of the details record component
    • error

      @Nullable public @Nullable Throwable error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component