Interface CodecContext

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      <T> JsonCodec<T> codec​(java.lang.Class<T> entityClass)
      Returns the JSON codec for the specified entity class.
      default <T> T decode​(com.fasterxml.jackson.databind.JsonNode json, java.lang.Class<T> entityClass)
      Decodes the specified entity from JSON using codec registered to this context.
      default <T> com.fasterxml.jackson.databind.node.ObjectNode encode​(T entity, java.lang.Class<T> entityClass)
      Encodes the specified entity into JSON using codec registered to this context.
      <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.
    • Method Detail

      • mapper

        com.fasterxml.jackson.databind.ObjectMapper mapper()
        Returns the JSON object mapper.
        Returns:
        object mapper
      • codec

        <T> JsonCodec<T> codec​(java.lang.Class<T> entityClass)
        Returns the JSON codec for the specified entity class.
        Type Parameters:
        T - entity type
        Parameters:
        entityClass - entity class
        Returns:
        JSON codec; null if no codec available for the class
      • getService

        <T> T getService​(java.lang.Class<T> serviceClass)
        Returns reference to the specified service implementation.
        Type Parameters:
        T - service type
        Parameters:
        serviceClass - service class
        Returns:
        service implementation; null if no implementation available for the class
      • decode

        default <T> T decode​(com.fasterxml.jackson.databind.JsonNode json,
                             java.lang.Class<T> entityClass)
        Decodes the specified entity from JSON using codec registered to this context.
        Type Parameters:
        T - entity type
        Parameters:
        json - JSON to decode
        entityClass - entity class
        Returns:
        decoded entity
      • encode

        default <T> com.fasterxml.jackson.databind.node.ObjectNode encode​(T entity,
                                                                          java.lang.Class<T> entityClass)
        Encodes the specified entity into JSON using codec registered to this context.
        Type Parameters:
        T - entity type
        Parameters:
        entity - entity to encode
        entityClass - entity class
        Returns:
        JSON node