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

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

Introduction

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

Prototype

public boolean isHeader() 

Source Link

Document

Responds true if this record is a header 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 ww . ja  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;
}