src/main/java/com/poiji/bind/mapping/PoijiHandler.java
private boolean setValue(String content, Class<? super T> type, int column) {
        // For ExcelRow annotation
        if(columnToField.containsKey(-1)) {
            Field field = columnToField.get(-1);
            Object o = casting.castValue(field.getType(), valueOf(internalCount), options);
            setFieldData(field, o, instance);
        }
        if(columnToField.containsKey(column)) {
            Field field = columnToField.get(column);
            if (columnToSuperClassField.containsKey(column)) {
                Object ins = null;
                ins = getInstance(columnToSuperClassField.get(column));
                if (setValue(field, column, content, ins)) {
                    setFieldData(columnToSuperClassField.get(column), ins, instance);
                    return true;
                } else {
                    return false;
                }
            }
            return setValue(field, column, content, instance);
        }
        for (Field field : type.getDeclaredFields()) {

            ExcelRow excelRow = field.getAnnotation(ExcelRow.class);
            if (excelRow != null) {
                Object o = casting.castValue(field.getType(), valueOf(internalCount), options);
                setFieldData(field, o, instance);
                columnToField.put(-1, field);
            }
            ExcelCellRange range = field.getAnnotation(ExcelCellRange.class);
            if (range != null) {
                Object ins = null;
                ins = getInstance(field);
                for (Field f : field.getType().getDeclaredFields()) {
                    if (setValue(f, column, content, ins)) {
                        setFieldData(field, ins, instance);
                        columnToField.put(column, f);
                        columnToSuperClassField.put(column, field);
                        return true;
                    }
                }
            } else {
                if(setValue(field, column, content, instance)) {
                    columnToField.put(column, field);
                    return true;
                }
            }
        }
        return false;
    }
private boolean setValue(String content, Class<? super T> type, int column) {
        // For ExcelRow annotation
        if(columnToField.containsKey(-1)) {
            Field field = columnToField.get(-1);
            Object o = casting.castValue(field.getType(), valueOf(internalCount), options);
            setFieldData(field, o, instance);
        }
        if(columnToField.containsKey(column)) {
            Field field = columnToField.get(column);
            if (columnToSuperClassField.containsKey(column)) {
                Object ins = null;
                ins = getInstance(columnToSuperClassField.get(column));
                if (setValue(field, column, content, ins)) {
                    setFieldData(columnToSuperClassField.get(column), ins, instance);
                    return true;
                } else {
                    return false;
                }
            }
            return setValue(field, column, content, instance);
        }
        for (Field field : type.getDeclaredFields()) {

            ExcelRow excelRow = field.getAnnotation(ExcelRow.class);
            if (excelRow != null) {
                Object o = casting.castValue(field.getType(), valueOf(internalCount), options);
                setFieldData(field, o, instance);
                columnToField.put(-1, field);
            }
            ExcelCellRange range = field.getAnnotation(ExcelCellRange.class);
            if (range != null) {
                Object ins = null;
                ins = getInstance(field);
                for (Field f : field.getType().getDeclaredFields()) {
                    if (setValue(f, column, content, ins)) {
                        setFieldData(field, ins, instance);
                        columnToField.put(column, f);
                        columnToSuperClassField.put(column, field);
                        return true;
                    }
                }
            } else {
                if(setValue(field, column, content, instance)) {
                    columnToField.put(column, field);
                    return true;
                }
            }
        }
        return false;
    }
private boolean setValue ( String content , Class < ? super T > type , int column ) { // For ExcelRow annotation if ( columnToField . containsKey ( - 1 ) ) { Field field = columnToField . get ( - 1 ) ; Object o = casting . castValue ( field . getType ( ) , valueOf ( internalCount ) , options ) ; setFieldData ( field , o , instance ) ; } if ( columnToField . containsKey ( column ) ) { Field field = columnToField . get ( column ) ; if ( columnToSuperClassField . containsKey ( column ) ) { Object ins = null ; ins = getInstance ( columnToSuperClassField . get ( column ) ) ; if ( setValue ( field , column , content , ins ) ) { setFieldData ( columnToSuperClassField . get ( column ) , ins , instance ) ; return true ; } else { return false ; } } return setValue ( field , column , content , instance ) ; } for ( Field field : type . getDeclaredFields ( ) ) { ExcelRow excelRow = field . getAnnotation ( ExcelRow . class ) ; if ( excelRow != null ) { Object o = casting . castValue ( field . getType ( ) , valueOf ( internalCount ) , options ) ; setFieldData ( field , o , instance ) ; columnToField . put ( - 1 , field ) ; } ExcelCellRange range = field . getAnnotation ( ExcelCellRange . class ) ; if ( range != null ) { Object ins = null ; ins = getInstance ( field ) ; for ( Field f : field . getType ( ) . getDeclaredFields ( ) ) { if ( setValue ( f , column , content , ins ) ) { setFieldData ( field , ins , instance ) ; columnToField . put ( column , f ) ; columnToSuperClassField . put ( column , field ) ; return true ; } } } else { if ( setValue ( field , column , content , instance ) ) { columnToField . put ( column , field ) ; return true ; } } } return false ; }
*
Modified this method so that for each time it reads a cell
it doesn't need to check all fields even after it as found
the matching field
* Modified this method so that for each time it reads a cell it doesn t need to check all fields even after it as found the matching field