use of io.crnk.client.response.JsonLinksInformation in project crnk-framework by crnk-project.
the class ClientStubBase method toResourceResponse.
private static Object toResourceResponse(Document document, ObjectMapper objectMapper) {
Object data = document.getData().get();
if (data instanceof List) {
DefaultResourceList<Resource> list = new DefaultResourceList<>();
list.addAll((List<Resource>) data);
if (document.getMeta() != null) {
list.setMeta(new JsonMetaInformation(document.getMeta(), objectMapper));
}
if (document.getLinks() != null) {
list.setLinks(new JsonLinksInformation(document.getMeta(), objectMapper));
}
return list;
} else {
return data;
}
}
Aggregations