Record Class StructuredPatch

java.lang.Object
java.lang.Record
com.kazforge.jsonapi.patch.StructuredPatch

public record StructuredPatch(List<StructuredMember> members) extends Record
Backend-independent low-level requested-change payload for a supplied structured value. The current Jackson adapters populate it through caller-configured Jackson.

A present structured value's requested changes: exactly the supplied nested members, in the application type's declaration order as the configured Jackson runtime resolves it. Omission is implied by absence — a member that is not present in members() was not supplied — mirroring the top-level PatchCommand.changes() philosophy. An empty members() list means the structured value was supplied as an explicit empty object (present, zero nested changes); it is never a clear-all or delete operation.

This is a payload, not a PatchChange variant. A recursively traversed attribute appears as an PatchChange.AttributeChange whose value is a StructuredPatch; recursively traversed resource or relationship meta uses the corresponding meta change variant with the same payload. Consumers discriminate it from an atomic replacement with instanceof and decide how to apply the requested nested changes.

Immutability: StructuredPatch and its members freeze recursively at construction; atomic container values use the same shallow-freeze convention as PatchChange.

  • Constructor Details

    • StructuredPatch

      public StructuredPatch(List<StructuredMember> members)
      Creates an instance of a StructuredPatch record class.
      Parameters:
      members - the value for the members record component
  • Method Details

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

      public List<StructuredMember> members()
      Returns the value of the members record component.
      Returns:
      the value of the members record component