Package com.kazforge.jsonapi.api
Record Class ResourceDocument<T>
java.lang.Object
java.lang.Record
com.kazforge.jsonapi.api.ResourceDocument<T>
public record ResourceDocument<T>(T resource, @Nullable com.kazforge.jsonapi.core.model.Meta meta, @Nullable com.kazforge.jsonapi.core.model.Links links, @Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi, @Nullable List<com.kazforge.jsonapi.core.model.ResourceObject> included)
extends Record
Level-1 typed read result for one resource plus selected document-level state.
Carries the bound primary DTO together with top-level meta, links,
jsonapi, and compound included state. Java null components mean the member was
absent; a non-null empty included list preserves a present "included": [] member.
Included resources are carried as validated core ResourceObject values in wire order,
never bound to DTOs: included state may be heterogeneous while this path stays homogeneous and
registry-free. Included resources are never hydrated into relationship properties. The result is
returned only after complete document validation. Error documents, identifier primary data, and
additional document members are not carried; reads requiring those states use the documents facet
or an advanced envelope instead.
-
Constructor Summary
ConstructorsConstructorDescriptionResourceDocument(T resource, @Nullable com.kazforge.jsonapi.core.model.Meta meta, @Nullable com.kazforge.jsonapi.core.model.Links links, @Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi, @Nullable List<com.kazforge.jsonapi.core.model.ResourceObject> included) Creates an instance of aResourceDocumentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable List<com.kazforge.jsonapi.core.model.ResourceObject> included()Returns the value of theincludedrecord component.@Nullable com.kazforge.jsonapi.core.model.JsonApiObjectjsonapi()Returns the value of thejsonapirecord component.@Nullable com.kazforge.jsonapi.core.model.Linkslinks()Returns the value of thelinksrecord component.@Nullable com.kazforge.jsonapi.core.model.Metameta()Returns the value of themetarecord component.resource()Returns the value of theresourcerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ResourceDocument
public ResourceDocument(T resource, @Nullable com.kazforge.jsonapi.core.model.Meta meta, @Nullable com.kazforge.jsonapi.core.model.Links links, @Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi, @Nullable List<com.kazforge.jsonapi.core.model.ResourceObject> included) Creates an instance of aResourceDocumentrecord class.- Parameters:
resource- the value for theresourcerecord componentmeta- the value for themetarecord componentlinks- the value for thelinksrecord componentjsonapi- the value for thejsonapirecord componentincluded- the value for theincludedrecord component
-
-
Method Details
-
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). -
resource
Returns the value of theresourcerecord component.- Returns:
- the value of the
resourcerecord component
-
meta
public @Nullable com.kazforge.jsonapi.core.model.Meta meta()Returns the value of themetarecord component.- Returns:
- the value of the
metarecord component
-
links
public @Nullable com.kazforge.jsonapi.core.model.Links links()Returns the value of thelinksrecord component.- Returns:
- the value of the
linksrecord component
-
jsonapi
public @Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi()Returns the value of thejsonapirecord component.- Returns:
- the value of the
jsonapirecord component
-
included
Returns the value of theincludedrecord component.- Returns:
- the value of the
includedrecord component
-