Package org.apache.juneau.bean.jsonapi
Class JsonApiRelationship
java.lang.Object
org.apache.juneau.bean.jsonapi.JsonApiRelationship
Represents a JSON:API Relationship Object as defined by
JSON:API v1.1 § Relationships.
A relationship carries:
data- resource linkage. Per spec, this can benull, a singleJsonApiResourceIdentifier, or a JSON array of identifiers. Modeled here asObject.links- related URLs. Each value can be either a JSON string URL or aJsonApiLinkobject; the field-levelJsonApiLinkOrStringSwapswap handles the union.meta- free-form meta bag.
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetData()Bean property getter:data .getLinks()Bean property getter:links .getMeta()Bean property getter:meta .Convenience method to add a single link.Convenience method to add a single meta entry.Bean property setter:data .setData(List<JsonApiResourceIdentifier> value) Typed setter for to-many linkage.setData(JsonApiResourceIdentifier value) Typed setter for single-identifier linkage.Bean property setter:links .Bean property setter:meta .toString()
-
Constructor Details
-
JsonApiRelationship
public JsonApiRelationship()Default constructor.
-
-
Method Details
-
getData
Bean property getter:data .Resource linkage. Per spec, this may be
null, a singleJsonApiResourceIdentifier, or aList<JsonApiResourceIdentifier>.- Returns:
- The value of the
data property, ornull if it is not set.
-
setData
Bean property setter:data .- Parameters:
value- The new value (single identifier, list of identifiers, ornullto unset).- Returns:
- This object.
-
setData
Typed setter for single-identifier linkage.- Parameters:
value- The identifier. Can benull to unset the property.- Returns:
- This object.
-
setData
Typed setter for to-many linkage.- Parameters:
value- The list of identifiers. Can benull to unset the property.- Returns:
- This object.
-
getLinks
Bean property getter:links .Per spec, each
linksvalue can be either a JSON string URL or aJsonApiLinkobject.- Returns:
- The value of the
links property, ornull if it is not set.
-
setLinks
@BeanProp("links") @Swap(JsonApiLinkOrStringSwap.class) public JsonApiRelationship setLinks(Map<String, Object> value) Bean property setter:links .- Parameters:
value- The new value for this property. Can benull to unset the property.- Returns:
- This object.
-
putLink
Convenience method to add a single link.- Parameters:
name- The link name. Can benull (LinkedHashMaptolerates anull key).value- The link value (aStringURL or aJsonApiLinkobject). Can benull (stored asnull ).- Returns:
- This object.
-
getMeta
Bean property getter:meta .- Returns:
- The value of the
meta property, ornull if it is not set.
-
setMeta
Bean property setter:meta .- Parameters:
value- The new value for this property. Can benull to unset the property.- Returns:
- This object.
-
putMeta
Convenience method to add a single meta entry.- Parameters:
name- The meta key. Can benull (LinkedHashMaptolerates anull key).value- The meta value. Can benull (stored asnull ).- Returns:
- This object.
-
toString
-