Class ObjectMapperPayloadReader

java.lang.Object
dev.getelements.elements.rt.jackson.ObjectMapperPayloadReader
All Implemented Interfaces:
PayloadReader

public class ObjectMapperPayloadReader extends Object implements PayloadReader
Uses an instance of ObjectMapper to deserialize the payload from the InputStream.
  • Constructor Details

    • ObjectMapperPayloadReader

      public ObjectMapperPayloadReader()
  • Method Details

    • convert

      public <T> T convert(Class<T> to, Object from)
      Description copied from interface: PayloadReader
      Reads the object to another type.
      Specified by:
      convert in interface PayloadReader
      Type Parameters:
      T - the type
      Parameters:
      to - the type to read
      from - the type from which to read
      Returns:
      an instance of the requested type, read from the supplied object.
    • read

      public <T> T read(Class<T> payloadType, InputStream stream) throws IOException
      Description copied from interface: PayloadReader
      Reads the actual response object to the InputStream.
      Specified by:
      read in interface PayloadReader
      Parameters:
      payloadType - the the response object
      stream - the output stream
      Throws:
      IOException
    • getObjectMapper

      public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • setObjectMapper

      @Inject public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)