Class JsonMapper

java.lang.Object
org.rostore.client.mapper.JsonMapper
All Implemented Interfaces:
Mapper

public class JsonMapper extends Object implements Mapper
This one uses the ObjectMapper to serialize / deserialize the content of the store
  • Constructor Details

    • JsonMapper

      public JsonMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
  • Method Details

    • fromObject

      public <K, V> InputStream fromObject(V value, K key)
      Serialization function
      Specified by:
      fromObject in interface Mapper
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      value - the value object
      key - the key object
      Returns:
      the serialized input stream
    • toObject

      public <K, V> V toObject(InputStream inputStream, Class<V> valueClass, K key)
      Deserialization function
      Specified by:
      toObject in interface Mapper
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      inputStream - the input stream to deserialize
      valueClass - the class of the value object
      key - the key object
      Returns:
      the deserialized value object
    • getContentType

      public ContentType getContentType()
      The content type of the input stream
      Specified by:
      getContentType in interface Mapper
      Returns:
      the content type used in the header