Package io.karatelabs.match
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 Summary
ConstructorsConstructorDescriptionFailure(String path, String reason, Value.Type actualType, Value.Type expectedType, Object actualValue, Object expectedValue, int depth) Creates an instance of aFailurerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theactualTyperecord component.Returns the value of theactualValuerecord component.intdepth()Returns the value of thedepthrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpectedTyperecord component.Returns the value of theexpectedValuerecord component.final inthashCode()Returns a hash code value for this object.path()Returns the value of thepathrecord component.reason()Returns the value of thereasonrecord component.toMap()final StringtoString()Returns a string representation of this record class.
-
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 aFailurerecord class.- Parameters:
path- the value for thepathrecord componentreason- the value for thereasonrecord componentactualType- the value for theactualTyperecord componentexpectedType- the value for theexpectedTyperecord componentactualValue- the value for theactualValuerecord componentexpectedValue- the value for theexpectedValuerecord componentdepth- the value for thedepthrecord component
-
-
Method Details
-
toMap
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
reason
Returns the value of thereasonrecord component.- Returns:
- the value of the
reasonrecord component
-
actualType
Returns the value of theactualTyperecord component.- Returns:
- the value of the
actualTyperecord component
-
expectedType
Returns the value of theexpectedTyperecord component.- Returns:
- the value of the
expectedTyperecord component
-
actualValue
Returns the value of theactualValuerecord component.- Returns:
- the value of the
actualValuerecord component
-
expectedValue
Returns the value of theexpectedValuerecord component.- Returns:
- the value of the
expectedValuerecord component
-
depth
public int depth()Returns the value of thedepthrecord component.- Returns:
- the value of the
depthrecord component
-