Class MultiResourceItemReader<T>

    • Constructor Detail

      • MultiResourceItemReader

        public MultiResourceItemReader()
    • Method Detail

      • read

        public T read()
               throws java.lang.Exception,
                      UnexpectedInputException,
                      ParseException
        Reads the next item, jumping to next resource if necessary.
        Returns:
        T the item to be processed or null if the data source is exhausted
        Throws:
        ParseException - if there is a problem parsing the current record (but the next one may still be valid)
        NonTransientResourceException - if there is a fatal exception in the underlying resource. After throwing this exception implementations should endeavour to return null from subsequent calls to read.
        UnexpectedInputException - if there is an uncategorised problem with the input data. Assume potentially transient, so subsequent calls to read might succeed.
        java.lang.Exception - if an there is a non-specific error.
      • setSaveState

        public void setSaveState​(boolean saveState)
        Set the boolean indicating whether or not state should be saved in the provided ExecutionContext during the ItemStream call to update.
        Parameters:
        saveState - true to update ExecutionContext. False do not update ExecutionContext.
      • setComparator

        public void setComparator​(java.util.Comparator<org.springframework.core.io.Resource> comparator)
        Parameters:
        comparator - used to order the injected resources, by default compares Resource.getFilename() values.
      • setResources

        public void setResources​(org.springframework.core.io.Resource[] resources)
        Parameters:
        resources - input resources
      • getCurrentResource

        @Nullable
        public org.springframework.core.io.Resource getCurrentResource()
        Getter for the current resource.
        Returns:
        the current resource or null if all resources have been processed or the first resource has not been assigned yet.