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

shz.paper.excel.ExcelData Maven / Gradle / Ivy

There is a newer version: 10.0.3
Show newest version
package shz.paper.excel;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import shz.core.NullHelp;
import shz.core.ToMap;

import java.util.Collections;
import java.util.Map;
import java.util.function.Function;

public final class ExcelData {
    public int sheetIndex;
    public Sheet sheet;
    public int rowIndex;
    public Row row;
    public Map data;

    public Map getStringData() {
        if (NullHelp.isEmpty(data)) return Collections.emptyMap();
        return ToMap.explicitCollect(
                data.keySet().stream(),
                Function.identity(),
                key -> ExcelHelp.getCellValue(data.get(key)),
                data.size()
        );
    }

    public int getSheetIndex() {
        return sheetIndex;
    }

    public void setSheetIndex(int sheetIndex) {
        this.sheetIndex = sheetIndex;
    }

    public Sheet getSheet() {
        return sheet;
    }

    public void setSheet(Sheet sheet) {
        this.sheet = sheet;
    }

    public int getRowIndex() {
        return rowIndex;
    }

    public void setRowIndex(int rowIndex) {
        this.rowIndex = rowIndex;
    }

    public Row getRow() {
        return row;
    }

    public void setRow(Row row) {
        this.row = row;
    }

    public Map getData() {
        return data;
    }

    public void setData(Map data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "ExcelData{" +
                "sheetIndex=" + sheetIndex +
                ", sheet=" + sheet +
                ", rowIndex=" + rowIndex +
                ", row=" + row +
                ", data=" + data +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy