Class AbstractWebResource

    • Method Summary

      All 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.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.
    • Constructor Detail

      • AbstractWebResource

        public AbstractWebResource()
    • Method Detail

      • mapper

        public com.fasterxml.jackson.databind.ObjectMapper mapper()
        Description copied from interface: CodecContext
        Returns the JSON object mapper.
        Specified by:
        mapper in interface CodecContext
        Returns:
        object mapper
      • codec

        public <T> JsonCodec<T> codec​(Class<T> entityClass)
        Returns the JSON codec for the specified entity class.
        Specified by:
        codec in interface CodecContext
        Type Parameters:
        T - entity type
        Parameters:
        entityClass - entity class
        Returns:
        JSON codec
      • encodeArray

        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.
        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
      • getService

        public <T> T getService​(Class<T> serviceClass)
        Description copied from interface: CodecContext
        Returns reference to the specified service implementation.
        Specified by:
        getService in interface CodecContext
        Type Parameters:
        T - service type
        Parameters:
        serviceClass - service class
        Returns:
        service implementation; null if no implementation available for the class
      • newObject

        public 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
      • newArray

        public 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