Class DefaultSerializer

java.lang.Object
org.davidmoten.oa3.codegen.http.DefaultSerializer
All Implemented Interfaces:
Serializer

public class DefaultSerializer extends Object implements Serializer
  • Constructor Details

    • DefaultSerializer

      public DefaultSerializer(com.fasterxml.jackson.databind.ObjectMapper m)
  • Method Details

    • serialize

      public void serialize(Object o, String contentType, OutputStream out)
      Specified by:
      serialize in interface Serializer
    • deserialize

      public <T> T deserialize(Class<T> cls, String contentType, InputStream in)
      Specified by:
      deserialize in interface Serializer
    • properties

      public Map<String,Object> properties(Object o, String contentType)
      Description copied from interface: Serializer
      Returns the properties of object. If has no properties or is not an object type that supports properties then returns an empty map. In the case of JSON the map value is of an imprecise type but will serialize to JSON in an expected deterministic way using Jackson serialization (i.e the object could be an annotated Jackson object or an instance of JsonNode).
      Specified by:
      properties in interface Serializer
      Parameters:
      o - object to get properties from, if null then returns an empty map
      contentType - content type of the object, cannot be null