Commit e96c4fb2 authored by liaozan's avatar liaozan 🏀

Add shortcut method for ExcelReadListenerBase

parent d74510d8
......@@ -30,7 +30,7 @@ public class ExcelBeanReadListener<T> extends ExcelReadListenerBase<T> {
protected void collectErrorMsg(AnalysisContext context, Set<ConstraintViolation<T>> violations) {
String sheetName = context.readSheetHolder().getSheetName();
Integer rowIndex = context.readRowHolder().getRowIndex();
getErrors().put(sheetName, rowIndex + 1, buildErrorMsg(violations));
addErrorMsg(sheetName, rowIndex + 1, buildErrorMsg(violations));
}
protected String buildErrorMsg(Set<ConstraintViolation<T>> violations) {
......
......@@ -64,6 +64,10 @@ public class ExcelReadListenerBase<T> extends AnalysisEventListener<T> {
return readResult;
}
protected void addErrorMsg(String sheetName, Integer rowIndex, String errorMsg) {
errors.put(sheetName, rowIndex, errorMsg);
}
protected String getErrorMsg() {
StringBuilder msgBuilder = new StringBuilder();
errors.rowMap().forEach((sheetName, rows) -> {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment