Package com.kazforge.jsonapi.mapping
Record Class RelationshipDecoration
java.lang.Object
java.lang.Record
com.kazforge.jsonapi.mapping.RelationshipDecoration
public record RelationshipDecoration(@Nullable com.kazforge.jsonapi.core.model.Links links)
extends Record
Additive relationship-level decoration for domain writes.
Carries only Relationship.links for an already-mapped @JsonApiRelationship. It
does not replace linkage, meta, or additional members, and it never creates a relationship that
normal mapping did not produce.
-
Constructor Summary
ConstructorsConstructorDescriptionRelationshipDecoration(@Nullable com.kazforge.jsonapi.core.model.Links links) Creates an instance of aRelationshipDecorationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic RelationshipDecorationempty()Returns an empty relationship decoration (no links).final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisEmpty()Returnstruewhen this decoration carries no links.@Nullable com.kazforge.jsonapi.core.model.Linkslinks()Returns the value of thelinksrecord component.static RelationshipDecorationlinks(com.kazforge.jsonapi.core.model.Links links) Alias forof(Links)that reads fluently when decorating relationships.static RelationshipDecorationof(com.kazforge.jsonapi.core.model.Links links) Creates a decoration with the given links.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RelationshipDecoration
public RelationshipDecoration(@Nullable com.kazforge.jsonapi.core.model.Links links) Creates an instance of aRelationshipDecorationrecord class.- Parameters:
links- the value for thelinksrecord component
-
-
Method Details
-
of
Creates a decoration with the given links.linksmust not benull; useempty()when no linkage-agnostic decoration is needed. -
links
Alias forof(Links)that reads fluently when decorating relationships. -
empty
Returns an empty relationship decoration (no links). -
isEmpty
public boolean isEmpty()Returnstruewhen this decoration carries no links. A present-emptyLinks(Links.empty()/"links":{}) is a wire-visible value and is not empty. -
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
-