Class JacksonJSONStorageObjectConverter

java.lang.Object
com.oracle.cloud.spring.storage.JacksonJSONStorageObjectConverter
All Implemented Interfaces:
StorageObjectConverter

public class JacksonJSONStorageObjectConverter extends Object implements StorageObjectConverter
Default implementation of StorageObjectConverter
  • Constructor Details

    • JacksonJSONStorageObjectConverter

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

    • write

      public <T> byte[] write(T object)
      Generates byte[] for the specific object
      Specified by:
      write in interface StorageObjectConverter
      Type Parameters:
      T - Type of Java POJO
      Parameters:
      object - Java POJO
      Returns:
      byte[]
    • read

      public <T> T read(InputStream is, Class<T> clazz)
      Create Java POJO of the specific class type from the input stream
      Specified by:
      read in interface StorageObjectConverter
      Type Parameters:
      T - Type of the Java POJO
      Parameters:
      is - InputStream to read data from.
      clazz - Class instance of the type of Java POJO
      Returns:
      Instance of Java POJO
    • contentType

      public String contentType()
      Returns JSON content type.
      Specified by:
      contentType in interface StorageObjectConverter
      Returns:
      "application/json"