Record Class Result.Failure

java.lang.Object
java.lang.Record
io.karatelabs.match.Result.Failure
Enclosing class:
Result

public static record Result.Failure(String path, String reason, Value.Type actualType, Value.Type expectedType, Object actualValue, Object expectedValue, int depth) extends Record
Represents a single failure in a match operation with structured data.
  • Constructor Details

    • Failure

      public Failure(String path, String reason, Value.Type actualType, Value.Type expectedType, Object actualValue, Object expectedValue, int depth)
      Creates an instance of a Failure record class.
      Parameters:
      path - the value for the path record component
      reason - the value for the reason record component
      actualType - the value for the actualType record component
      expectedType - the value for the expectedType record component
      actualValue - the value for the actualValue record component
      expectedValue - the value for the expectedValue record component
      depth - the value for the depth record component
  • Method Details

    • toMap

      public Map<String,Object> toMap()
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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
    • reason

      public String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component
    • actualType

      public Value.Type actualType()
      Returns the value of the actualType record component.
      Returns:
      the value of the actualType record component
    • expectedType

      public Value.Type expectedType()
      Returns the value of the expectedType record component.
      Returns:
      the value of the expectedType record component
    • actualValue

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

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

      public int depth()
      Returns the value of the depth record component.
      Returns:
      the value of the depth record component