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

com.fredericboisguerin.excel.description.SheetDescription Maven / Gradle / Ivy

There is a newer version: 2.1
Show newest version
package com.fredericboisguerin.excel.description;

import com.fredericboisguerin.excel.common.Information;
import org.apache.poi.ss.util.CellReference;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by fboisguerin on 23/07/2015.
 */
public class SheetDescription {

    private final Map columnIndexInfoMap = new HashMap<>();
    private final int breaklLoopOnEmptyColumnIdx;
    private final int startRowPayloadIdx;
    private String name;

    /**
     * Default constructor
     *
     * @param breaklLoopOnEmptyColumnIdx The index of the column (indexed from 0) to use for loop break condition
     * @param startRowPayloadIdx         The start row index (indexed from 1) for this sheet
     */
    public SheetDescription(int breaklLoopOnEmptyColumnIdx, int startRowPayloadIdx) {
        this.breaklLoopOnEmptyColumnIdx = breaklLoopOnEmptyColumnIdx;
        this.startRowPayloadIdx = startRowPayloadIdx;
    }

    /**
     * Add a column to parse, with his name and the type of information
     *
     * @param columnName  The name of the column, representing its index ("A", "B", "AA"...)
     * @param information The information to parse for the column
     */
    public void addColumnInfo(String columnName, Information information) {
        columnIndexInfoMap.put(CellReference.convertColStringToIndex(columnName), information);
    }

    public Map getColumnIndexInfoMap() {
        return columnIndexInfoMap;
    }

    public short getBreaklLoopOnEmptyColumnIdx() {
        return (short) breaklLoopOnEmptyColumnIdx;
    }

    public int getStartRowPayloadIdx() {
        return startRowPayloadIdx;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy