Example usage for org.springframework.batch.sample.domain.multiline AggregateItem getItem

List of usage examples for org.springframework.batch.sample.domain.multiline AggregateItem getItem

Introduction

In this page you can find the example usage for org.springframework.batch.sample.domain.multiline AggregateItem getItem.

Prototype

public T getItem() 

Source Link

Document

Accessor for the wrapped item.

Usage

From source file:org.springframework.batch.sample.domain.multiline.AggregateItemReader.java

private boolean process(AggregateItem<T> value, ResultHolder holder) {
    // finish processing if we hit the end of file
    if (value == null) {
        LOG.debug("Exhausted ItemReader");
        holder.setExhausted(true);/*from   ww  w .j  a va 2s. c o  m*/
        return false;
    }

    // start a new collection
    if (value.isHeader()) {
        LOG.debug("Start of new record detected");
        return true;
    }

    // mark we are finished with current collection
    if (value.isFooter()) {
        LOG.debug("End of record detected");
        return false;
    }

    // add a simple record to the current collection
    LOG.debug("Mapping: " + value);
    holder.addRecord(value.getItem());
    return true;
}