org.gageot.excel.core
Class RowMapperSheetExtractor

java.lang.Object
  extended by org.gageot.excel.core.RowMapperSheetExtractor
All Implemented Interfaces:
SheetExtractor

public class RowMapperSheetExtractor
extends java.lang.Object
implements SheetExtractor

Adapter implementation of the SheetExtractor interface that delegates to a RowMapper which is supposed to create an object for each row. Each object is added to the results List of this SheetExtractor.

Useful for the typical case of one object per row in the Excel spreadsheet. The number of entries in the results list will match the number of rows.

Note that a RowMapper object is typically stateless and thus reusable; just the RowMapperResultSetExtractor adapter is stateful.

Author:
David Gageot
See Also:
RowMapper

Constructor Summary
RowMapperSheetExtractor(RowMapper aRowMapper)
          Create a new RowMapperSheetExtractor.
 
Method Summary
 java.lang.Object extractData(org.apache.poi.hssf.usermodel.HSSFSheet sheet)
          Implementations must implement this method to process all rows in the HSSFSheet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RowMapperSheetExtractor

public RowMapperSheetExtractor(RowMapper aRowMapper)
Create a new RowMapperSheetExtractor.

Parameters:
aRowMapper - the RowMapper which creates an object for each row
Method Detail

extractData

public java.lang.Object extractData(org.apache.poi.hssf.usermodel.HSSFSheet sheet)
                             throws java.io.IOException
Description copied from interface: SheetExtractor
Implementations must implement this method to process all rows in the HSSFSheet.

Specified by:
extractData in interface SheetExtractor
Parameters:
sheet - HSSFSheet to extract data from.
Returns:
an arbitrary result object, or null if none (the extractor will typically be stateful in the latter case).
Throws:
java.io.IOException - if a IOException is encountered getting column values or navigating (that is, there's no need to catch IOException)


Copyright © 2007 gageot.net. All Rights Reserved.