io.github.millij.poi.ss.handler.RowBeanCollector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of poi-object-mapper Show documentation
Show all versions of poi-object-mapper Show documentation
Objects mapper for Office formats - Excel files, Spreadsheets, etc.
The newest version!
package io.github.millij.poi.ss.handler;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
*/
public final class RowBeanCollector implements RowListener {
private static final Logger LOGGER = LoggerFactory.getLogger(RowBeanCollector.class);
// Properties
private final List beans;
// Constructors
public RowBeanCollector() {
super();
// init
this.beans = new ArrayList<>();
}
// Getters and Setters
public List getBeans() {
return Collections.unmodifiableList(beans);
}
// RowListener
// ------------------------------------------------------------------------
@Override
public void row(int rowNum, T rowObj) {
if (Objects.isNull(rowObj)) {
LOGGER.warn("NULL object returned for row : {}", rowNum);
return;
}
beans.add(rowObj);
}
}