Class JacksonMapperParser

  • All Implemented Interfaces:
    com.google.api.client.util.ObjectParser

    public final class JacksonMapperParser
    extends java.lang.Object
    implements com.google.api.client.util.ObjectParser
    JSON serializer implementation based on Jackson databinding module. Usage: HttpRequest request = requestFactory.buildGetRequest(url); request.setParser(new JacksonMapperParser(new ObjectMapper())); HttpResponse response = request.execute(); MyDataType data = response.parseAs(MyDataType.class); Implementation is not thread-safe.
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T parseAndClose​(java.io.InputStream in, java.nio.charset.Charset charset, java.lang.Class<T> dataClass)  
      java.lang.Object parseAndClose​(java.io.InputStream in, java.nio.charset.Charset charset, java.lang.reflect.Type dataType)  
      <T> T parseAndClose​(java.io.Reader reader, java.lang.Class<T> dataClass)  
      java.lang.Object parseAndClose​(java.io.Reader reader, java.lang.reflect.Type dataType)  
      • Methods inherited from class java.lang.Object

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

      • JacksonMapperParser

        public JacksonMapperParser​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
        Parameters:
        objectMapper - Jackson databinder
    • Method Detail

      • parseAndClose

        public <T> T parseAndClose​(java.io.InputStream in,
                                   java.nio.charset.Charset charset,
                                   java.lang.Class<T> dataClass)
                            throws java.io.IOException
        Specified by:
        parseAndClose in interface com.google.api.client.util.ObjectParser
        Throws:
        java.io.IOException
      • parseAndClose

        public java.lang.Object parseAndClose​(java.io.InputStream in,
                                              java.nio.charset.Charset charset,
                                              java.lang.reflect.Type dataType)
                                       throws java.io.IOException
        Specified by:
        parseAndClose in interface com.google.api.client.util.ObjectParser
        Throws:
        java.io.IOException
      • parseAndClose

        public <T> T parseAndClose​(java.io.Reader reader,
                                   java.lang.Class<T> dataClass)
                            throws java.io.IOException
        Specified by:
        parseAndClose in interface com.google.api.client.util.ObjectParser
        Throws:
        java.io.IOException
      • parseAndClose

        public java.lang.Object parseAndClose​(java.io.Reader reader,
                                              java.lang.reflect.Type dataType)
                                       throws java.io.IOException
        Specified by:
        parseAndClose in interface com.google.api.client.util.ObjectParser
        Throws:
        java.io.IOException