Record Class ResourceWriteOptions

java.lang.Object
java.lang.Record
com.kazforge.jsonapi.api.ResourceWriteOptions

public record ResourceWriteOptions(DocumentEnvelope envelope, RepresentationSelection selection) extends Record
Backend-independent ordinary resource-write options composing existing neutral semantics. The current Jackson adapters interpret these values through caller-configured Jackson.

Carries the per-write document envelope (top-level links, meta, and JSON:API object) together with the per-operation representation selection (include paths and sparse fieldsets). An absent per-write jsonapi member (a null component on the envelope) is distinct from an explicit per-write JsonApiObject: explicit values override the configured application-lifetime document default, while absence leaves that default in effect.

Representation policy is application/runtime configuration owned by the major-specific runtime, not a per-write value: these options deliberately carry no policy, so a default write always inherits the runtime's effective policy instead of overriding it with a concrete default. Per-call policy overrides remain advanced.

Use defaults() for the documented ordinary behavior: no document-level members and no inclusion or fieldsets.

  • Constructor Details

    • ResourceWriteOptions

      public ResourceWriteOptions(DocumentEnvelope envelope, RepresentationSelection selection)
      Creates an instance of a ResourceWriteOptions record class.
      Parameters:
      envelope - the value for the envelope record component
      selection - the value for the selection record component
  • Method Details

    • defaults

      public static ResourceWriteOptions defaults()
      Returns options with no envelope members and no selection.
    • withEnvelope

      public ResourceWriteOptions withEnvelope(DocumentEnvelope envelope)
      Returns options with the given envelope and this selection.
    • withSelection

      public ResourceWriteOptions withSelection(RepresentationSelection selection)
      Returns options with the given selection and this envelope.
    • 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.
    • envelope

      public DocumentEnvelope envelope()
      Returns the value of the envelope record component.
      Returns:
      the value of the envelope record component
    • selection

      public RepresentationSelection selection()
      Returns the value of the selection record component.
      Returns:
      the value of the selection record component