Class GsonJsonObjectReader<T>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclose()
      Close the input resource.
      voidopen​(org.springframework.core.io.Resource resource)
      Open the Json resource for reading.
      Tread()
      Read the next object in the Json resource if any.
      voidsetMapper​(com.google.gson.Gson mapper)
      Set the object mapper to use to map Json objects to domain objects.
      • Methods inherited from class java.lang.Object

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

      • GsonJsonObjectReader

        public GsonJsonObjectReader​(java.lang.Class<? extends T> itemType)
        Create a new GsonJsonObjectReader instance.
        Parameters:
        itemType - the target item type
    • Method Detail

      • setMapper

        public void setMapper​(com.google.gson.Gson mapper)
        Set the object mapper to use to map Json objects to domain objects.
        Parameters:
        mapper - the object mapper to use
      • open

        public void open​(org.springframework.core.io.Resource resource)
                  throws java.lang.Exception
        Description copied from interface: JsonObjectReader
        Open the Json resource for reading.
        Specified by:
        open in interface JsonObjectReader<T>
        Parameters:
        resource - the input resource
        Throws:
        java.lang.Exception - if unable to open the resource
      • read

        public T read()
               throws java.lang.Exception
        Description copied from interface: JsonObjectReader
        Read the next object in the Json resource if any.
        Specified by:
        read in interface JsonObjectReader<T>
        Returns:
        the next object or null if the resource is exhausted
        Throws:
        java.lang.Exception - if unable to read the next object
      • close

        public void close()
                   throws java.lang.Exception
        Description copied from interface: JsonObjectReader
        Close the input resource.
        Specified by:
        close in interface JsonObjectReader<T>
        Throws:
        java.lang.Exception - if unable to close the input resource