All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.millij.poi.ss.handler.RowBeanCollector Maven / Gradle / Ivy

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);
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy