Class JacksonJSONSerializer

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.fasterxml.jackson.databind.ObjectMapper objectMapper  
    • Constructor Summary

      Constructors 
      Constructor Description
      JacksonJSONSerializer​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)  
    • Field Detail

      • objectMapper

        protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • Constructor Detail

      • JacksonJSONSerializer

        public JacksonJSONSerializer​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    • Method Detail

      • serialize

        public String serialize​(Object obj)
        Description copied from interface: JSONSerializer
        Serialize the object to JSON
        Specified by:
        serialize in interface JSONSerializer
        Parameters:
        obj - the object to serialize
        Returns:
        the serialized json payload as a String
      • serializeAsBytes

        public byte[] serializeAsBytes​(Object obj)
        Description copied from interface: JSONSerializer
        Serialize the object to JSON
        Specified by:
        serializeAsBytes in interface JSONSerializer
        Parameters:
        obj - the object to serialize
        Returns:
        the serialized json payload as a byte[]
      • deserialize

        public <T> T deserialize​(String json,
                                 String javaType)
        Description copied from interface: JSONSerializer
        Deserialize the payload in the json parameter into the Java type specified by the Fully Qualified Class Name contained in the javaType parameter
        Specified by:
        deserialize in interface JSONSerializer
        Type Parameters:
        T - the corresponding Java type
        Parameters:
        json - the json payload
        javaType - the Fully Qualified Class Name for the Java type that the json payload should be deserialized into
        Returns:
        the deserialized json payload
      • deserialize

        public <T> T deserialize​(String json,
                                 Class<T> javaType)
        Description copied from interface: JSONSerializer
        Deserialize the payload in the json parameter into the Java type specified by the javaType parameter
        Specified by:
        deserialize in interface JSONSerializer
        Type Parameters:
        T - the corresponding Java type
        Parameters:
        json - the json payload
        javaType - the Java type that the json payload should be deserialized into
        Returns:
        the deserialized json payload
      • deserialize

        public <T> T deserialize​(byte[] json,
                                 String javaType)
        Description copied from interface: JSONSerializer
        Deserialize the payload in the json parameter into the Java type specified by the Fully Qualified Class Name contained in the javaType parameter
        Specified by:
        deserialize in interface JSONSerializer
        Type Parameters:
        T - the corresponding Java type
        Parameters:
        json - the json payload
        javaType - the Fully Qualified Class Name for the Java type that the json payload should be deserialized into
        Returns:
        the deserialized json payload
      • deserialize

        public <T> T deserialize​(byte[] json,
                                 Class<T> javaType)
        Description copied from interface: JSONSerializer
        Deserialize the payload in the json parameter into the Java type specified by the javaType parameter
        Specified by:
        deserialize in interface JSONSerializer
        Type Parameters:
        T - the corresponding Java type
        Parameters:
        json - the json payload
        javaType - the Java type that the json payload should be deserialized into
        Returns:
        the deserialized json payload