org.shoulder.batch.spi.csv.DefaultDataItemConvertFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shoulder-batch Show documentation
Show all versions of shoulder-batch Show documentation
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 extends DataItem> 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;
}
}