Class JacksonGraphQLJsonSerializer

  • All Implemented Interfaces:
    GraphQLJsonSerializer

    @Singleton
    public class JacksonGraphQLJsonSerializer
    extends java.lang.Object
    implements GraphQLJsonSerializer
    The Jackson implementation for serializing and deserializing GraphQL objects.
    Since:
    1.0
    • 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

      • JacksonGraphQLJsonSerializer

        @Deprecated
        public JacksonGraphQLJsonSerializer​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
        Default constructor.
        Parameters:
        objectMapper - the ObjectMapper instance
      • JacksonGraphQLJsonSerializer

        @Inject
        public JacksonGraphQLJsonSerializer​(io.micronaut.json.JsonMapper jsonMapper)
        Default constructor.
        Parameters:
        jsonMapper - the JsonMapper instance
        Since:
        3.1.0
    • Method Detail

      • serialize

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

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