Record Class JsonSchemaException.ValidationError

java.lang.Object
java.lang.Record
cloud.opencode.base.json.exception.JsonSchemaException.ValidationError
Enclosing class:
JsonSchemaException

public static record JsonSchemaException.ValidationError(String path, String keyword, String message, Object expected, Object actual) extends Record
Validation Error - Represents a Single Schema Validation Error 验证错误 - 表示单个 Schema 验证错误
Since:
JDK 25, opencode-base-json V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • ValidationError

      public ValidationError(String path, String keyword, String message)
      Creates a validation error with path, keyword, and message. 使用路径、关键字和消息创建验证错误。
      Parameters:
      path - the JSON Pointer path - JSON Pointer 路径
      keyword - the schema keyword - Schema 关键字
      message - the error message - 错误消息
    • ValidationError

      public ValidationError(String path, String keyword, String message, Object expected, Object actual)
      Creates an instance of a ValidationError record class.
      Parameters:
      path - the value for the path record component
      keyword - the value for the keyword record component
      message - the value for the message record component
      expected - the value for the expected record component
      actual - the value for the actual record component
  • Method Details

    • 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.
    • path

      public String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • keyword

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

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

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

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