Last active
January 21, 2017 01:16
-
-
Save emetsger/7840d1ec13223f19e1fa4d9bc43fe19f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java b/src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java | |
index d0a7d92..d1a1323 100644 | |
--- a/src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java | |
+++ b/src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java | |
@@ -457,8 +457,20 @@ public class ResourceConverter { | |
if (linkNode != null && ((link = getLink(linkNode)) != null)) { | |
if (isCollection(relationship)) { | |
+ final JSONAPIDocument<? extends List<?>> doc = | |
+ readDocumentCollection(new ByteArrayInputStream(resolver.resolve(link)), type); | |
+ JSONAPIDocument<? extends List<?>> supplier = doc; | |
+ List accumulator = doc.get(); | |
+ while (supplier.getLinks() != null && supplier.getLinks().getNext() != null) { | |
+ supplier = readDocumentCollection( | |
+ new ByteArrayInputStream( | |
+ resolver.resolve(supplier.getLinks().getNext().getHref())), | |
+ type); | |
+ accumulator.addAll(supplier.get()); | |
+ } | |
+ | |
relationshipField.set(object, | |
- readDocumentCollection(new ByteArrayInputStream(resolver.resolve(link)), type).get()); | |
+ accumulator); | |
} else { | |
relationshipField.set(object, readDocument(new ByteArrayInputStream(resolver.resolve(link)), type).get()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment