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

org.shoulder.batch.spi.csv.DefaultDataItemConvertFactory Maven / Gradle / Ivy

Go to download

Shoulder 扩展-批处理模块,提供批量数据导入、导出、异步校验、导入历史记录管理等能力。

The newest version!

package org.shoulder.batch.spi.csv;

import com.univocity.parsers.common.record.IndexedRecordImpl;
import com.univocity.parsers.common.record.Record;
import org.shoulder.batch.spi.DataItem;

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

/**
 * @author lym
 */
public class DefaultDataItemConvertFactory implements DataItemConvertFactory {

    @Override public List convertRecordToDataItem(String dataType, List recordList) {
        List resultList = new ArrayList<>(recordList.size());
        // 跳过 header 行,只处理数据行
        for (int i = 1; i < recordList.size(); i++) {
            resultList.add(new IndexedRecordImpl(recordList.get(i), i));
        }
        return resultList;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy