Record Class RelationshipLinkage<T,M>
- Type Parameters:
T- the ordinary relationship target typeM- the application-owned identifier-meta type
target() is mapped exactly as the corresponding ordinary relationship target would
be. meta() maps exclusively to that occurrence's JSON:API
ResourceIdentifier.meta; it is not relationship-level meta (Relationship.meta)
and is not resource-level meta (ResourceObject.meta).
The wrapper is optional. Ordinary @JsonApiRelationship shapes — a single target,
List/Set/array/Optional of targets, a direct ResourceIdentifier,
or a custom linkage mapping — remain valid when identifier meta is not required. Applications
that need per-linkage identifier meta declare the richer value:
@JsonApiRelationship
RelationshipLinkage<Person, AuthorMeta> author;
@JsonApiRelationship
List<RelationshipLinkage<Comment, CommentMeta>> comments;
meta == null supplies no identifier meta: the target is mapped normally, and any
ResourceIdentifier.meta already present on a direct identifier target is left in place.
When meta is present, the declared M converts through the configured authority
and replaces the identifier's meta wholesale: conversion non-emission preserves any existing
identifier meta, an emitted JSON null clears it, an emitted object replaces it, and any
other emitted shape fails as an invalid meta target. The wrapper itself is not a JSON:API
resource and is not independently patchable; identifier meta participates in presence-aware PATCH
only as part of whole-linkage replacement.
-
Constructor Summary
ConstructorsConstructorDescriptionRelationshipLinkage(T target, @Nullable M meta) Creates an instance of aRelationshipLinkagerecord 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 Mmeta()Returns the value of themetarecord component.target()Returns the value of thetargetrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RelationshipLinkage
Creates an instance of aRelationshipLinkagerecord class.- Parameters:
target- the value for thetargetrecord componentmeta- the value for themetarecord 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). -
target
Returns the value of thetargetrecord component.- Returns:
- the value of the
targetrecord component
-
meta
Returns the value of themetarecord component.- Returns:
- the value of the
metarecord component
-