public class AbstractWebResource extends org.onlab.rest.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.
|
public com.fasterxml.jackson.databind.ObjectMapper mapper()
CodecContextmapper in interface CodecContextpublic <T> JsonCodec<T> codec(Class<T> entityClass)
codec in interface CodecContextT - 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)
CodecContextgetService in interface CodecContextT - service typeserviceClass - service classCopyright © 2015. All rights reserved.