Interface JsonObjectReader<T>

  • Type Parameters:
    T - type of the target object
    All Known Implementing Classes:
    GsonJsonObjectReader, JacksonJsonObjectReader

    public interface JsonObjectReader<T>
    Strategy interface for Json readers. Implementations are expected to use a streaming API in order to read Json objects one at a time.
    Since:
    4.1
    Author:
    Mahmoud Ben Hassine
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and TypeMethodDescription
      default voidclose()
      Close the input resource.
      default voidopen​(org.springframework.core.io.Resource resource)
      Open the Json resource for reading.
      Tread()
      Read the next object in the Json resource if any.
    • Method Detail

      • open

        default void open​(org.springframework.core.io.Resource resource)
                   throws java.lang.Exception
        Open the Json resource for reading.
        Parameters:
        resource - the input resource
        Throws:
        java.lang.Exception - if unable to open the resource
      • read

        @Nullable
        T read()
        throws java.lang.Exception
        Read the next object in the Json resource if any.
        Returns:
        the next object or null if the resource is exhausted
        Throws:
        java.lang.Exception - if unable to read the next object
      • close

        default void close()
                    throws java.lang.Exception
        Close the input resource.
        Throws:
        java.lang.Exception - if unable to close the input resource