Package com.kazforge.jsonapi.document
Record Class DocumentEnvelope
java.lang.Object
java.lang.Record
com.kazforge.jsonapi.document.DocumentEnvelope
public record DocumentEnvelope(@Nullable com.kazforge.jsonapi.core.model.Links links, @Nullable com.kazforge.jsonapi.core.model.Meta meta, @Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi)
extends Record
Optional top-level links, meta, and JSON:API object attached during domain mapping.
A null component means that member is absent and is omitted from the serialized
document. A non-null empty value remains present: for example, Links.empty() and Meta.empty() produce empty links and meta objects rather than absence.
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentEnvelope(@Nullable com.kazforge.jsonapi.core.model.Links links, @Nullable com.kazforge.jsonapi.core.model.Meta meta, @Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi) Creates an instance of aDocumentEnveloperecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentEnvelopeempty()Returns an envelope with every member absent, not present-empty.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@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.static DocumentEnvelopeofJsonApi(@Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi) Returns an envelope containing only ajsonapiobject, or no members whennull.static DocumentEnvelopeofLinks(@Nullable com.kazforge.jsonapi.core.model.Links links) Returns an envelope containing only links, or no members whennull.static DocumentEnvelopeofMeta(@Nullable com.kazforge.jsonapi.core.model.Meta meta) Returns an envelope containing only metadata, or no members whennull.final StringtoString()Returns a string representation of this record class.withJsonApi(@Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi) Returns a copy replacing thejsonapiobject, or omitting it whennull.withLinks(@Nullable com.kazforge.jsonapi.core.model.Links links) Returns a copy replacing links, or omitting them whennull.withMeta(@Nullable com.kazforge.jsonapi.core.model.Meta meta) Returns a copy replacing metadata, or omitting it whennull.
-
Constructor Details
-
DocumentEnvelope
public DocumentEnvelope(@Nullable com.kazforge.jsonapi.core.model.Links links, @Nullable com.kazforge.jsonapi.core.model.Meta meta, @Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi) Creates an instance of aDocumentEnveloperecord class.- Parameters:
links- the value for thelinksrecord componentmeta- the value for themetarecord componentjsonapi- the value for thejsonapirecord component
-
-
Method Details
-
empty
Returns an envelope with every member absent, not present-empty. -
ofLinks
Returns an envelope containing only links, or no members whennull. -
ofMeta
Returns an envelope containing only metadata, or no members whennull. -
ofJsonApi
public static DocumentEnvelope ofJsonApi(@Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi) Returns an envelope containing only ajsonapiobject, or no members whennull. -
withLinks
Returns a copy replacing links, or omitting them whennull. -
withMeta
Returns a copy replacing metadata, or omitting it whennull. -
withJsonApi
public DocumentEnvelope withJsonApi(@Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi) Returns a copy replacing thejsonapiobject, or omitting it whennull. -
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). -
links
public @Nullable com.kazforge.jsonapi.core.model.Links links()Returns the value of thelinksrecord component.- Returns:
- the value of the
linksrecord component
-
meta
public @Nullable com.kazforge.jsonapi.core.model.Meta meta()Returns the value of themetarecord component.- Returns:
- the value of the
metarecord component
-
jsonapi
public @Nullable com.kazforge.jsonapi.core.model.JsonApiObject jsonapi()Returns the value of thejsonapirecord component.- Returns:
- the value of the
jsonapirecord component
-