类 SimpleChunkProcessor<I,​O>

    • 方法详细资料

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Check mandatory properties.
        指定者:
        afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBean
        抛出:
        java.lang.Exception
        另请参阅:
        InitializingBean.afterPropertiesSet()
      • setListeners

        public void setListeners​(java.util.List<? extends StepListener> listeners)
        Register some StepListeners with the handler. Each will get the callbacks in the order specified at the correct stage.
        参数:
        listeners - list of StepListener instances.
      • doProcess

        protected final O doProcess​(I item)
                             throws java.lang.Exception
        参数:
        item - the input item
        返回:
        the result of the processing
        抛出:
        java.lang.Exception - thrown if error occurs.
      • doWrite

        protected final void doWrite​(java.util.List<O> items)
                              throws java.lang.Exception
        Surrounds the actual write call with listener callbacks.
        参数:
        items - list of items to be written.
        抛出:
        java.lang.Exception - thrown if error occurs.
      • doAfterWrite

        protected final void doAfterWrite​(java.util.List<O> items)
        Call the listener's after write method.
        参数:
        items - list of items that were just written.
      • doOnWriteError

        protected final void doOnWriteError​(java.lang.Exception e,
                                            java.util.List<O> items)
        Call listener's writerError method.
        参数:
        e - exception that occurred.
        items - list of items that failed to be written.
      • writeItems

        protected void writeItems​(java.util.List<O> items)
                           throws java.lang.Exception
        参数:
        items - list of items to be written.
        抛出:
        java.lang.Exception - thrown if error occurs.
      • initializeUserData

        protected void initializeUserData​(Chunk<I> inputs)
        Extension point for subclasses to allow them to memorise the contents of the inputs, in case they are needed for accounting purposes later. The default implementation sets up some user data to remember the original size of the inputs. If this method is overridden then some or all of isComplete(Chunk), getFilterCount(Chunk, Chunk) and getAdjustedOutputs(Chunk, Chunk) might also need to be, to ensure that the user data is handled consistently.
        参数:
        inputs - the inputs for the process
      • getFilterCount

        protected int getFilterCount​(Chunk<I> inputs,
                                     Chunk<O> outputs)
        Extension point for subclasses to calculate the filter count. Defaults to the difference between input size and output size.
        参数:
        inputs - the inputs after transformation
        outputs - the outputs after transformation
        返回:
        the difference in sizes
        另请参阅:
        initializeUserData(Chunk)
      • isComplete

        protected boolean isComplete​(Chunk<I> inputs)
        Extension point for subclasses that want to store additional data in the inputs. Default just checks if inputs are empty.
        参数:
        inputs - the input chunk
        返回:
        true if it is empty
        另请参阅:
        initializeUserData(Chunk)
      • getAdjustedOutputs

        protected Chunk<OgetAdjustedOutputs​(Chunk<I> inputs,
                                              Chunk<O> outputs)
        Extension point for subclasses that want to adjust the outputs based on additional saved data in the inputs. Default implementation just returns the outputs unchanged.
        参数:
        inputs - the inputs for the transformation
        outputs - the result of the transformation
        返回:
        the outputs unchanged
        另请参阅:
        initializeUserData(Chunk)
      • write

        protected void write​(StepContribution contribution,
                             Chunk<I> inputs,
                             Chunk<O> outputs)
                      throws java.lang.Exception
        Simple implementation delegates to the doWrite(List) method and increments the write count in the contribution. Subclasses can handle more complicated scenarios, e.g.with fault tolerance. If output items are skipped they should be removed from the inputs as well.
        参数:
        contribution - the current step contribution
        inputs - the inputs that gave rise to the outputs
        outputs - the outputs to write
        抛出:
        java.lang.Exception - if there is a problem