Record Class JsonWriter.MemberPath

java.lang.Object
java.lang.Record
org.springframework.boot.json.JsonWriter.MemberPath
Record Components:
parent - the parent of this path
name - the name of the member or null if the member is indexed. Path names are provided as they were defined when the member was added and do not include any name processing.
index - the index of the member or UNINDEXED
Enclosing interface:
JsonWriter<T>

public static record JsonWriter.MemberPath(JsonWriter.MemberPath parent, String name, int index) extends Record
A path used to identify a specific JSON member. Paths can be represented as strings in form "my.json[1].item" where elements are separated by '.' or [<index>]. Reserved characters are escaped using '\'.
  • Field Details

    • UNINDEXED

      public static final int UNINDEXED
      Indicates that the member has no index.
      See Also:
  • Constructor Details

    • MemberPath

      public MemberPath(JsonWriter.MemberPath parent, String name, int index)
      Creates an instance of a MemberPath record class.
      Parameters:
      parent - the value for the parent record component
      name - the value for the name record component
      index - the value for the index record component
  • Method Details

    • child

      public JsonWriter.MemberPath child(int index)
      Create a new child from this path with the specified index.
      Parameters:
      index - the index of the child
      Returns:
      a new JsonWriter.MemberPath instance
    • child

      public JsonWriter.MemberPath child(String name)
      Create a new child from this path with the specified name.
      Parameters:
      name - the name of the child
      Returns:
      a new JsonWriter.MemberPath instance
    • 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
    • toUnescapedString

      public final String toUnescapedString()
      Return a string representation of the path without any escaping.
      Returns:
      the unescaped string representation
    • of

      public static JsonWriter.MemberPath of(String value)
      Create a new JsonWriter.MemberPath instance from the given string.
      Parameters:
      value - the path value
      Returns:
      a new JsonWriter.MemberPath instance
    • 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.
    • parent

      public JsonWriter.MemberPath parent()
      Returns the value of the parent record component.
      Returns:
      the value of the parent record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • index

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