public abstract class JsonCodec<T>
extends java.lang.Object
Constructor and Description |
---|
JsonCodec() |
Modifier and Type | Method and Description |
---|---|
java.util.List<T> |
decode(com.fasterxml.jackson.databind.node.ArrayNode json,
CodecContext context)
Decodes the specified JSON array into a collection of entities.
|
T |
decode(com.fasterxml.jackson.databind.node.ObjectNode json,
CodecContext context)
Decodes the specified entity from JSON.
|
com.fasterxml.jackson.databind.node.ArrayNode |
encode(java.lang.Iterable<T> entities,
CodecContext context)
Encodes the collection of the specified entities.
|
com.fasterxml.jackson.databind.node.ObjectNode |
encode(T entity,
CodecContext context)
Encodes the specified entity into JSON.
|
protected static com.fasterxml.jackson.databind.node.ObjectNode |
get(com.fasterxml.jackson.databind.JsonNode parent,
int childIndex)
Gets a child Object Node from a parent by index.
|
protected static com.fasterxml.jackson.databind.node.ObjectNode |
get(com.fasterxml.jackson.databind.node.ObjectNode parent,
java.lang.String childName)
Gets a child Object Node from a parent by name.
|
public com.fasterxml.jackson.databind.node.ObjectNode encode(T entity, CodecContext context)
entity
- entity to encodecontext
- encoding contextjava.lang.UnsupportedOperationException
- if the codec does not
support encode operationspublic T decode(com.fasterxml.jackson.databind.node.ObjectNode json, CodecContext context)
json
- JSON to decodecontext
- decoding contextjava.lang.UnsupportedOperationException
- if the codec does not
support decode operationspublic com.fasterxml.jackson.databind.node.ArrayNode encode(java.lang.Iterable<T> entities, CodecContext context)
entities
- collection of entities to encodecontext
- encoding contextjava.lang.UnsupportedOperationException
- if the codec does not
support encode operationspublic java.util.List<T> decode(com.fasterxml.jackson.databind.node.ArrayNode json, CodecContext context)
json
- JSON array to decodecontext
- decoding contextjava.lang.UnsupportedOperationException
- if the codec does not
support decode operationsprotected static com.fasterxml.jackson.databind.node.ObjectNode get(com.fasterxml.jackson.databind.node.ObjectNode parent, java.lang.String childName)
parent
- parent objectchildName
- name of child to queryprotected static com.fasterxml.jackson.databind.node.ObjectNode get(com.fasterxml.jackson.databind.JsonNode parent, int childIndex)
parent
- parent objectchildIndex
- index of child to query