T
- Type of a particular object to be encoded/decodedpublic interface JsonCodec<T>
Modifier and Type | Method and Description |
---|---|
T |
decode(com.fasterxml.jackson.databind.node.ObjectNode node)
Decodes the JSON into a typed POJO.
|
T |
decode(String json)
Decodes the JSON string into a typed POJO.
|
List<T> |
decodeList(String json)
Decodes the JSON string into a typed list of POJO.
|
com.fasterxml.jackson.databind.node.ObjectNode |
encode(T pojo)
Encodes the given POJO to its JSON representation.
|
String |
encode(T pojo,
boolean prettyPrint)
Encodes the given POJO to its JSON string representation.
|
com.fasterxml.jackson.databind.node.ArrayNode |
encodeIterator(Iterator<T> pojos)
Encodes the collection of POJOs to their JSON representation.
|
String |
encodeIterator(Iterator<T> pojos,
boolean prettyPrint)
Encodes the collection of POJOs to their JSON string representation.
|
com.fasterxml.jackson.databind.node.ArrayNode |
encodeList(Collection<T> pojos)
Encodes the collection of POJOs to their JSON representation.
|
String |
encodeList(Collection<T> pojos,
boolean prettyPrint)
Encodes the collection of POJOs to their JSON string representation.
|
String |
root()
Returns the root element's singular name.
|
String |
roots()
Returns the root element's plural name.
|
String root()
String roots()
String encode(T pojo, boolean prettyPrint)
pojo
- POJO to encodeprettyPrint
- Human-readable formatted JSON if true, single-line
JSON otherwisecom.fasterxml.jackson.databind.node.ArrayNode encodeList(Collection<T> pojos)
pojos
- list of POJO's to encodeString encodeList(Collection<T> pojos, boolean prettyPrint)
pojos
- list of POJO's to encodeprettyPrint
- human-readable formatted JSON if true, single-line
JSON otherwisecom.fasterxml.jackson.databind.node.ArrayNode encodeIterator(Iterator<T> pojos)
pojos
- iterator over a Collection of POJO's to encodeString encodeIterator(Iterator<T> pojos, boolean prettyPrint)
pojos
- iterator over a Collection of POJO's to encodeprettyPrint
- human-readable formatted JSON if true, single-line
JSON otherwiseT decode(String json)
json
- JSON string representation of the typed POJOList<T> decodeList(String json)
json
- JSON string representation of the typed list of POJOscom.fasterxml.jackson.databind.node.ObjectNode encode(T pojo)
pojo
- POJO to encodeT decode(com.fasterxml.jackson.databind.node.ObjectNode node)
node
- JSON representation of the typed POJO. This does not have a
"top" rootCopyright © 2015. All Rights Reserved.