public class AbstractWebResource extends BaseResource implements CodecContext
Constructor and Description |
---|
AbstractWebResource() |
Modifier and Type | Method and Description |
---|---|
<T> JsonCodec<T> |
codec(java.lang.Class<T> entityClass)
Returns the JSON codec for the specified entity class.
|
protected <T> com.fasterxml.jackson.databind.node.ObjectNode |
encodeArray(java.lang.Class<T> codecClass,
java.lang.String field,
java.lang.Iterable<T> items)
Returns JSON object wrapping the array encoding of the specified
collection of items.
|
<T> T |
getService(java.lang.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,
java.lang.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,
java.lang.String key)
Creates and returns a new child object within the specified parent and
bound to the given key.
|
get, ok, setServiceDirectory
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(java.lang.Class<T> entityClass)
codec
in interface CodecContext
T
- entity typeentityClass
- entity classprotected <T> com.fasterxml.jackson.databind.node.ObjectNode encodeArray(java.lang.Class<T> codecClass, java.lang.String field, java.lang.Iterable<T> items)
T
- item typecodecClass
- codec item classfield
- field holding the arrayitems
- collection of items to be encoded into arraypublic <T> T getService(java.lang.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, java.lang.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, java.lang.String key)
parent
- parent objectkey
- key for the new child array