Package com.kazforge.jsonapi.api
Interface JsonApiRelationships
public interface JsonApiRelationships
Level-1 relationship-linkage document operations in both directions.
The facet is linkage-only: it expresses to-one, explicit-null, and to-many identifier primary data without domain DTO registration and without hydrating related-resource documents. A to-one read never accepts a collection and a to-many read never accepts one identifier or null; cross-shape states fail instead of coercing. Related-resource handling and top-level document members on linkage documents stay on the documents facet or an advanced path.
-
Method Summary
Modifier and TypeMethodDescriptionList<com.kazforge.jsonapi.core.model.ResourceIdentifier> readToMany(InputStream json) Stream variant ofreadToMany(String).List<com.kazforge.jsonapi.core.model.ResourceIdentifier> readToMany(String json) Reads a to-many linkage document, including the empty collection.@Nullable com.kazforge.jsonapi.core.model.ResourceIdentifierreadToOne(InputStream json) Stream variant ofreadToOne(String).@Nullable com.kazforge.jsonapi.core.model.ResourceIdentifierReads a to-one linkage document.writeToMany(List<? extends com.kazforge.jsonapi.core.model.ResourceIdentifier> identifiers) Writes a to-many linkage document and returns its JSON.voidwriteToMany(List<? extends com.kazforge.jsonapi.core.model.ResourceIdentifier> identifiers, OutputStream out) Writes a to-many linkage document to the given stream.writeToOne(@Nullable com.kazforge.jsonapi.core.model.ResourceIdentifier identifier) Writes a to-one linkage document and returns its JSON.voidwriteToOne(@Nullable com.kazforge.jsonapi.core.model.ResourceIdentifier identifier, OutputStream out) Writes a to-one linkage document to the given stream.
-
Method Details
-
readToOne
Reads a to-one linkage document. Returns the identifier, ornullfor explicitdata: nulllinkage. -
readToOne
Stream variant ofreadToOne(String). The stream is not closed. Returns the identifier, ornullfor explicitdata: nulllinkage. -
readToMany
Reads a to-many linkage document, including the empty collection. -
readToMany
Stream variant ofreadToMany(String). The stream is not closed. -
writeToOne
Writes a to-one linkage document and returns its JSON. Anullidentifier emits explicitdata: nulllinkage. -
writeToOne
void writeToOne(@Nullable com.kazforge.jsonapi.core.model.ResourceIdentifier identifier, OutputStream out) Writes a to-one linkage document to the given stream. The stream is not closed. Anullidentifier emits explicitdata: nulllinkage. -
writeToMany
Writes a to-many linkage document and returns its JSON.The wildcard bound lets callers pass lists held through generic APIs; it is redundant only because
ResourceIdentifieris final. -
writeToMany
void writeToMany(List<? extends com.kazforge.jsonapi.core.model.ResourceIdentifier> identifiers, OutputStream out) Writes a to-many linkage document to the given stream. The stream is not closed.The wildcard bound lets callers pass lists held through generic APIs; it is redundant only because
ResourceIdentifieris final.
-