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

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

Introduction

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

Prototype

public boolean isFooter() 

Source Link

Document

Responds true if this record is a footer in an aggregate.

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   w  w w.  j a v  a2s .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;
}