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

com.github.rrsunhome.excelsql.config.BaseParserConfig Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package com.github.rrsunhome.excelsql.config;


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author : qijia.wang
 * create at:  2020/3/31  下午3:43
 */
public abstract class BaseParserConfig {

    private static final int DEFAULT_READ_ROW = 1;

    private static final int DEFAULT_TITLE_ROW_INDEX = 0;

    /**
     * 标题行下标
     */
    private Integer titleRowIndex = DEFAULT_TITLE_ROW_INDEX;

    /**
     * 数据行范围
     */
    private Range rowRange = Range.createNumRange(DEFAULT_READ_ROW, Integer.MAX_VALUE);

    /**
     * 列映射
     */
    private List cellMappings = new ArrayList<>();

    protected BaseParserConfig() {
    }

    protected BaseParserConfig(List cellIndexArgs) {
        for (int cellIndex : cellIndexArgs) {
            this.addCellMapping(CellMapping.builder().cellNum(cellIndex).build());
        }
    }

    public void addCellMapping(CellMapping cellMapping) {
        cellMappings.add(cellMapping);
    }

    public List getCellMappings() {
        return Collections.unmodifiableList(cellMappings);
    }

    public void setTitleRowIndex(Integer titleRowIndex) {
        this.titleRowIndex = titleRowIndex;
    }

    public void setRowRange(int startRow, int endRow) {
        this.rowRange = Range.createNumRange(startRow, endRow);
    }
    public void setStartRow(int startRow) {
        this.rowRange = Range.createNumRange(startRow, Integer.MAX_VALUE);
    }

    public Integer getTitleRowIndex() {
        return titleRowIndex;
    }

    public Range getRowRange() {
        return rowRange;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy