/** * Peek at the next item, ensuring that if the delegate is an * {@link ItemStream} the state is stored for the next call to * {@link #update(ExecutionContext)}. * * @return the next item (or null if there is none). * * @see PeekableItemReader#peek() */ @Override public T peek() throws Exception, UnexpectedInputException, ParseException { if (next == null) { updateDelegate(executionContext); next = delegate.read(); } return next; }
/** * If there is a cached peek, then retrieve the execution context state from * that point. If there is no peek cached, then call directly to the * delegate. * * @param executionContext the current context * @throws ItemStreamException if there is a problem * @see ItemStream#update(ExecutionContext) */ @Override public void update(ExecutionContext executionContext) throws ItemStreamException { if (next != null) { // Get the last state from the delegate instead of using // current value. for (Entry<String, Object> entry : this.executionContext.entrySet()) { executionContext.put(entry.getKey(), entry.getValue()); } return; } updateDelegate(executionContext); }
/** * Peek at the next item, ensuring that if the delegate is an * {@link ItemStream} the state is stored for the next call to * {@link #update(ExecutionContext)}. * * @return the next item (or null if there is none). * * @see PeekableItemReader#peek() */ @Override public T peek() throws Exception, UnexpectedInputException, ParseException { if (next == null) { updateDelegate(executionContext); next = delegate.read(); } return next; }
/** * If there is a cached peek, then retrieve the execution context state from * that point. If there is no peek cached, then call directly to the * delegate. * * @param executionContext the current context * @throws ItemStreamException if there is a problem * @see ItemStream#update(ExecutionContext) */ @Override public void update(ExecutionContext executionContext) throws ItemStreamException { if (next != null) { // Get the last state from the delegate instead of using // current value. for (Entry<String, Object> entry : this.executionContext.entrySet()) { executionContext.put(entry.getKey(), entry.getValue()); } return; } updateDelegate(executionContext); }