public class AbstractWebResource extends BaseResource implements CodecContext
Constructor and Description |
---|
AbstractWebResource() |
Modifier and Type | Method and Description |
---|---|
<T> JsonCodec<T> |
codec(Class<T> entityClass)
Returns the JSON codec for the specified entity class.
|
protected <T> com.fasterxml.jackson.databind.node.ObjectNode |
encodeArray(Class<T> codecClass,
String field,
Iterable<T> items)
Returns JSON object wrapping the array encoding of the specified
collection of items.
|
<T> T |
getService(Class<T> serviceClass)
Returns reference to the specified service implementation.
|
com.fasterxml.jackson.databind.ObjectMapper |
mapper()
Returns the JSON object mapper.
|
com.fasterxml.jackson.databind.node.ArrayNode |
newArray(com.fasterxml.jackson.databind.node.ObjectNode parent,
String key)
Creates and returns a new child array within the specified parent and
bound to the given key.
|
com.fasterxml.jackson.databind.node.ObjectNode |
newObject(com.fasterxml.jackson.databind.node.ObjectNode parent,
String key)
Creates and returns a new child object within the specified parent and
bound to the given key.
|
get, ok
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decode, encode
public com.fasterxml.jackson.databind.ObjectMapper mapper()
CodecContext
mapper
in interface CodecContext
public <T> JsonCodec<T> codec(Class<T> entityClass)
codec
in interface CodecContext
T
- entity typeentityClass
- entity classprotected <T> com.fasterxml.jackson.databind.node.ObjectNode encodeArray(Class<T> codecClass, String field, Iterable<T> items)
T
- item typecodecClass
- codec item classfield
- field holding the arrayitems
- collection of items to be encoded into arraypublic <T> T getService(Class<T> serviceClass)
CodecContext
getService
in interface CodecContext
T
- service typeserviceClass
- service classpublic com.fasterxml.jackson.databind.node.ObjectNode newObject(com.fasterxml.jackson.databind.node.ObjectNode parent, String key)
parent
- parent objectkey
- key for the new child objectpublic com.fasterxml.jackson.databind.node.ArrayNode newArray(com.fasterxml.jackson.databind.node.ObjectNode parent, String key)
parent
- parent objectkey
- key for the new child array