Package name.martingeisse.grumpyjson
Record Class FieldErrorNode.FlattenedError
java.lang.Object
java.lang.Record
name.martingeisse.grumpyjson.FieldErrorNode.FlattenedError
- Record Components:
message- the error messagefieldPath- the field names, from root to leaf
- Enclosing class:
FieldErrorNode
public static record FieldErrorNode.FlattenedError(String message, List<String> fieldPath)
extends Record
This structure represents a single error, i.e. a leaf node, and contains the error message of the
FieldErrorNode.Message
node as well as the field path as a list of the field names of all FieldErrorNode.Field nodes on the way from the
root to the message leaf node.
Since every FieldErrorNode.Siblings node allows for two different paths to take, a whole tree must be represented as
a _list_ of flattened errors.
-
Constructor Summary
ConstructorsConstructorDescriptionFlattenedError(String message, String... pathSegments) this constructor is very useful in unit testsFlattenedError(String message, List<String> fieldPath) Constructor -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of thefieldPathrecord component.Returns the field path as a dot-separated stringfinal inthashCode()Returns a hash code value for this object.message()Returns the value of themessagerecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
FlattenedError
Constructor- Parameters:
message- the error messagefieldPath- the field names, from root to leaf
-
FlattenedError
this constructor is very useful in unit tests- Parameters:
message- the error messagepathSegments- the field names, from root to leaf
-
-
Method Details
-
getPathAsString
Returns the field path as a dot-separated string- Returns:
- the field path
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-
fieldPath
Returns the value of thefieldPathrecord component.- Returns:
- the value of the
fieldPathrecord component
-