Record Class MappedDocument

java.lang.Object
java.lang.Record
com.kazforge.jsonapi.mapping.MappedDocument

public record MappedDocument(com.kazforge.jsonapi.core.model.JsonApiDocument document, Set<com.kazforge.jsonapi.core.model.ResourceIdentity> sparseFieldsetLinkageExemptions) extends Record
Domain-mapping result that carries the produced document plus the identities of included resources whose inbound linkage was removed by an applied sparse fieldset during that mapping call.

Those sparse-fieldset linkage exemptions are mapping provenance, not authorization or caller policy. Pass the whole MappedDocument, rather than only document(), to a JSON:API document writer; the writer composes its bound ValidationContext with the provenance before validating and emitting. An empty set means the mapped document carries no linkage exception and validates like any ordinary document.

  • Constructor Summary

    Constructors
    Constructor
    Description
    MappedDocument(com.kazforge.jsonapi.core.model.JsonApiDocument document, Set<com.kazforge.jsonapi.core.model.ResourceIdentity> sparseFieldsetLinkageExemptions)
    Creates an instance of a MappedDocument record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.kazforge.jsonapi.core.model.JsonApiDocument
    Returns the value of the document record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Set<com.kazforge.jsonapi.core.model.ResourceIdentity>
    Returns the value of the sparseFieldsetLinkageExemptions record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MappedDocument

      public MappedDocument(com.kazforge.jsonapi.core.model.JsonApiDocument document, Set<com.kazforge.jsonapi.core.model.ResourceIdentity> sparseFieldsetLinkageExemptions)
      Creates an instance of a MappedDocument record class.
      Parameters:
      document - the value for the document record component
      sparseFieldsetLinkageExemptions - the value for the sparseFieldsetLinkageExemptions 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.
    • document

      public com.kazforge.jsonapi.core.model.JsonApiDocument document()
      Returns the value of the document record component.
      Returns:
      the value of the document record component
    • sparseFieldsetLinkageExemptions

      public Set<com.kazforge.jsonapi.core.model.ResourceIdentity> sparseFieldsetLinkageExemptions()
      Returns the value of the sparseFieldsetLinkageExemptions record component.
      Returns:
      the value of the sparseFieldsetLinkageExemptions record component