Package com.kazforge.jsonapi.mapping
Class ResourceDecoration
java.lang.Object
com.kazforge.jsonapi.mapping.ResourceDecoration
Backend-independent additive resource-level decoration for domain writes. It is applied by the
shared backend-neutral decoration phase after the basic write.
Carries only:
ResourceObject.links, and- per-relationship
Relationship.linksfor existing mapped relationships
"comments"
for a Java field named comments) — not the configured-Jackson external property name
(e.g. @JsonProperty("article-comments")) and not a separately supplied final JSON:API
member name. The mapper translates the identity through the configured external name and applies
each entry under the final wire member name automatically, so
@JsonProperty("article-comments") does not require a second key.
Decoration is immutable: the relationship map is defensively copied and unmodifiable. Null
keys, null values, and empty property names are rejected. Use builder() for incremental
assembly or empty() when no decoration is needed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable builder whoseResourceDecoration.Builder.build()result defensively copies supplied values. -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceDecoration.Builderbuilder()Creates a builder for one immutable decoration.static ResourceDecorationempty()Returns an empty decoration (no resource links, no relationship decorations).booleaninthashCode()booleanisEmpty()Returnstruewhen this decoration carries neither resource nor relationship links.@Nullable com.kazforge.jsonapi.core.model.Linkslinks()Resource links to add, ornullwhen none.static ResourceDecorationofLinks(com.kazforge.jsonapi.core.model.Links links) Returns a decoration that contributes only resource links.Relationship decorations by mapped property identity (logical name), unmodifiable.toString()
-
Method Details
-
empty
Returns an empty decoration (no resource links, no relationship decorations). -
ofLinks
Returns a decoration that contributes only resource links. -
builder
Creates a builder for one immutable decoration. -
links
public @Nullable com.kazforge.jsonapi.core.model.Links links()Resource links to add, ornullwhen none. -
relationships
Relationship decorations by mapped property identity (logical name), unmodifiable. Values are nevernull; keys are nevernullor empty. -
isEmpty
public boolean isEmpty()Returnstruewhen this decoration carries neither resource nor relationship links. A present-emptyLinks(Links.empty()/"links":{}) is a wire-visible value and is not considered empty; onlynullmeans absence. -
equals
-
hashCode
public int hashCode() -
toString
-