Class JacksonJsonSerializer

java.lang.Object
graphql.spring.web.servlet.components.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

    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 Details

    • JacksonJsonSerializer

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

    • 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