T - the type parameterpublic class JSONAPIDocument<T> extends Object
| Constructor and Description |
|---|
JSONAPIDocument()
Creates new JSONAPIDocument.
|
JSONAPIDocument(Error error)
Creates new JSONAPIDocument.
|
JSONAPIDocument(Iterable<? extends Error> errors)
Creates new JSONAPIDocument.
|
JSONAPIDocument(T data)
Creates new JsonApiDocument.
|
JSONAPIDocument(T data,
Links links,
Map<String,Object> meta)
Creates new JsonApiDocument.
|
JSONAPIDocument(T data,
Links links,
Map<String,Object> meta,
com.fasterxml.jackson.databind.ObjectMapper deserializer)
Creates new JsonApiDocument.
|
JSONAPIDocument(T data,
com.fasterxml.jackson.databind.ObjectMapper deserializer)
Creates new JSONAPIDocument.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLink(String linkName,
Link link)
Adds a named link.
|
void |
addMeta(String key,
Object value) |
static JSONAPIDocument<?> |
createErrorDocument(Iterable<? extends Error> errors)
Factory method for creating JSONAPIDocument that holds the Error object.
|
T |
get()
Gets resource object
|
Iterable<? extends Error> |
getErrors()
Returns error objects or
null in case no errors were set. |
Links |
getLinks()
Gets links.
|
Map<String,?> |
getMeta()
Get meta data.
|
<T> T |
getMeta(Class<?> metaType)
Returns typed meta-data object or
null if no meta is present. |
void |
setLinks(Links links)
Sets links.
|
void |
setMeta(Map<String,?> meta)
Sets meta data.
|
public JSONAPIDocument(T data)
data - T API resource typepublic JSONAPIDocument(T data, com.fasterxml.jackson.databind.ObjectMapper deserializer)
data - T API resource typedeserializer - ObjectMapper deserializer to be used for handling meta conversionpublic JSONAPIDocument(T data, Links links, Map<String,Object> meta)
data - T API resource typelinks - @link Links} linksmeta - Map metapublic JSONAPIDocument(T data, Links links, Map<String,Object> meta, com.fasterxml.jackson.databind.ObjectMapper deserializer)
data - T API resource typelinks - @link Links} linksmeta - Map metadeserializer - ObjectMapper deserializer to be used for handling meta conversionpublic JSONAPIDocument()
public JSONAPIDocument(Iterable<? extends Error> errors)
errors - errorspublic JSONAPIDocument(Error error)
error - errorpublic static JSONAPIDocument<?> createErrorDocument(Iterable<? extends Error> errors)
This method should be used in case error response is being built by the server side.
errors - public T get()
T resource objectpublic Links getLinks()
public void addLink(String linkName, Link link)
linkName - the named link to addlink - the link to addpublic void setLinks(Links links)
links - the linkspublic <T> T getMeta(Class<?> metaType)
null if no meta is present.T - typemetaType - Class target typenullCopyright © 2018. All rights reserved.