package com.mtcarpenter.mall.excel;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
 
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
 
public class ExcelListener extends AnalysisEventListener {
 
    //自定义用于暂时存储data
    //private List<Object> datas = Collections.synchronizedList(new ArrayList<>());
    private List<Object> datas = new ArrayList<>();
    
    /**
     * 通过 AnalysisContext 对象还可以获取当前 sheet，当前行等数据
     */
    @Override
    public void invoke(Object o, AnalysisContext analysisContext) {
        datas.add(o);
    }
 
    /**
     * 读取完之后的操作
     */
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        
    }
 
    public List<Object> getDatas() {
        return datas;
    }
 
    public void setDatas(List<Object> datas) {
        this.datas = datas;
    }
}