Record Class ValidationResult

java.lang.Object
java.lang.Record
com.esprow.oapi.ValidationResult

public record ValidationResult(ValidationResult.Severity severity, String message, ValidationResult[] details) extends Record
Represents a validation result as a message, severity level, and optional nested results.
  • Field Details

    • OK_RESULT

      public static final ValidationResult OK_RESULT
      The shared object which can be used to represent "OK" result, when there are no errors or warnings.
  • Constructor Details

    • ValidationResult

      public ValidationResult(ValidationResult.Severity severity, String message, ValidationResult[] details)
      Creates an instance of a ValidationResult record class.
      Parameters:
      severity - the value for the severity record component
      message - the value for the message record component
      details - the value for the details record component
  • Method Details

    • merge

      public ValidationResult merge(ValidationResult otherResult)
      Merges the result with a given one.
      Parameters:
      otherResult - the other validation result
      Returns:
      new merged result, having a message and a severity level from the result having highest one. Detail results are appended.
    • toString

      public 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.
    • severity

      public ValidationResult.Severity 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
    • details

      public ValidationResult[] details()
      Returns the value of the details record component.
      Returns:
      the value of the details record component