Package org.onosproject.rest
Class AbstractWebResource
- java.lang.Object
- 
- org.onlab.rest.BaseResource
- 
- org.onosproject.rest.AbstractWebResource
 
 
- 
- All Implemented Interfaces:
- CodecContext
 - Direct Known Subclasses:
- AbstractInjectionResource
 
 public class AbstractWebResource extends BaseResource implements CodecContext Abstract REST resource.
- 
- 
Constructor SummaryConstructors Constructor Description AbstractWebResource()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> JsonCodec<T>codec(Class<T> entityClass)Returns the JSON codec for the specified entity class.protected <T> com.fasterxml.jackson.databind.node.ObjectNodeencodeArray(Class<T> codecClass, String field, Iterable<T> items)Returns JSON object wrapping the array encoding of the specified collection of items.<T> TgetService(Class<T> serviceClass)Returns reference to the specified service implementation.com.fasterxml.jackson.databind.ObjectMappermapper()Returns the JSON object mapper.com.fasterxml.jackson.databind.node.ArrayNodenewArray(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.ObjectNodenewObject(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.- 
Methods inherited from class org.onlab.rest.BaseResourceget, ok
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.onosproject.codec.CodecContextdecode, encode
 
- 
 
- 
- 
- 
Method Detail- 
mapperpublic com.fasterxml.jackson.databind.ObjectMapper mapper() Description copied from interface:CodecContextReturns the JSON object mapper.- Specified by:
- mapperin interface- CodecContext
- Returns:
- object mapper
 
 - 
codecpublic <T> JsonCodec<T> codec(Class<T> entityClass) Returns the JSON codec for the specified entity class.- Specified by:
- codecin interface- CodecContext
- Type Parameters:
- T- entity type
- Parameters:
- entityClass- entity class
- Returns:
- JSON codec
 
 - 
encodeArrayprotected <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.- Type Parameters:
- T- item type
- Parameters:
- codecClass- codec item class
- field- field holding the array
- items- collection of items to be encoded into array
- Returns:
- JSON object
 
 - 
getServicepublic <T> T getService(Class<T> serviceClass) Description copied from interface:CodecContextReturns reference to the specified service implementation.- Specified by:
- getServicein interface- CodecContext
- Type Parameters:
- T- service type
- Parameters:
- serviceClass- service class
- Returns:
- service implementation; null if no implementation available for the class
 
 - 
newObjectpublic 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.- Parameters:
- parent- parent object
- key- key for the new child object
- Returns:
- child object
 
 - 
newArraypublic 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.- Parameters:
- parent- parent object
- key- key for the new child array
- Returns:
- child array
 
 
- 
 
-