You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

package com.alibaba.excel.event;
import java.util.Map;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.util.ConverterUtils;
/**
* Receives the return of each piece of data parsed
*
* @author jipengfei
*/
public abstract class AnalysisEventListener<T> implements ReadListener<T> {
@Override
public void invokeHead(Map<Integer, CellData> headMap, AnalysisContext context) {
invokeHeadMap(ConverterUtils.convertToStringMap(headMap, context.currentReadHolder()), context);
}
/**
* Returns the header as a map.Override the current method to receive header data.
*
* @param headMap
* @param context
*/
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {}
/**
* All listeners receive this method when any one Listener does an error report. If an exception is thrown here, the
* entire read will terminate.
*
* @param exception
* @param context
*/
@Override
public void onException(Exception exception, AnalysisContext context) throws Exception {
throw exception;
}
@Override
public boolean hasNext(AnalysisContext context) {
return true;
}
}