private < T > T readIntoBean ( final T bean , final String [ ] nameMapping , final CellProcessor [ ] processors ) throws IOException { if ( readRow ( ) ) { if ( nameMapping . length != length ( ) ) { throw new IllegalArgumentException ( String . format ( "the nameMapping array and the number of columns read " + "should be the same size (nameMapping length = %d, columns = %d)" , nameMapping . length , length ( ) ) ) ; } if ( processors == null ) { processedColumns . clear ( ) ; processedColumns . addAll ( getColumns ( ) ) ; } else { executeProcessors ( processedColumns , processors ) ; } return populateBean ( bean , nameMapping ) ; } return null ; // EOF }
Reads a row of a CSV file and populates the bean using the supplied name mapping to map column values to the appropriate fields . If processors are supplied then they are used otherwise the raw String values will be used .