Class JacksonJsonSerializer

  • All Implemented Interfaces:
    JsonSerializer

    @Component
    public class JacksonJsonSerializer
    extends java.lang.Object
    implements JsonSerializer
    • Constructor Summary

      Constructors 
      Constructor Description
      JacksonJsonSerializer​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T deserialize​(java.lang.String json, java.lang.Class<T> requiredType)
      Deserializes the given json String to an object of the required type.
      java.lang.String serialize​(java.lang.Object object)
      Serializes the given object to a json String.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JacksonJsonSerializer

        @Autowired
        public JacksonJsonSerializer​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    • Method Detail

      • serialize

        public java.lang.String serialize​(java.lang.Object object)
        Description copied from interface: JsonSerializer
        Serializes the given object to a json String.
        Specified by:
        serialize in interface JsonSerializer
        Parameters:
        object - the object to serialize
        Returns:
        the json string
      • deserialize

        public <T> T deserialize​(java.lang.String json,
                                 java.lang.Class<T> requiredType)
        Description copied from interface: JsonSerializer
        Deserializes the given json String to an object of the required type.
        Specified by:
        deserialize in interface JsonSerializer
        Type Parameters:
        T - the required generic type
        Parameters:
        json - the json string
        requiredType - the required type
        Returns:
        the object