Module jp.ecuacion.util.poi
Class StringOneLineHeaderExcelTableToBeanReader<T extends StringExcelTableBean>
java.lang.Object
jp.ecuacion.util.poi.excel.table.ExcelTable<String>
jp.ecuacion.util.poi.excel.table.reader.ExcelTableReader<String>
jp.ecuacion.util.poi.excel.table.reader.concrete.StringOneLineHeaderExcelTableReader
jp.ecuacion.util.poi.excel.table.reader.concrete.StringOneLineHeaderExcelTableToBeanReader<T>
- All Implemented Interfaces:
IfDataTypeStringExcelTable,IfExcelTable<String>,IfFormatOneLineHeaderExcelTable<String>,IfDataTypeStringExcelTableReader,IfExcelTableReader<String>,IfFormatOneLineHeaderExcelTableReader<String>
public class StringOneLineHeaderExcelTableToBeanReader<T extends StringExcelTableBean>
extends StringOneLineHeaderExcelTableReader
Stores the excel table data into a bean.
-
Field Summary
Fields inherited from class jp.ecuacion.util.poi.excel.table.reader.ExcelTableReader
tableColumnSize, tableRowSizeFields inherited from class jp.ecuacion.util.poi.excel.table.ExcelTable
sheetName, tableStartColumnNumber, tableStartRowNumber -
Constructor Summary
ConstructorsConstructorDescriptionStringOneLineHeaderExcelTableToBeanReader(Class<?> beanClass, String sheetName, String[] headerLabels, Integer tableStartRowNumber, int tableStartColumnNumber, Integer tableRowSize, NoDataString noDataString) Constructs a new instance with the obtained value from an empty cell.StringOneLineHeaderExcelTableToBeanReader(Class<?> beanClass, String sheetName, String[] headerLabels, Integer tableStartRowNumber, int tableStartColumnNumber, Integer tableRowSize, T... parameterClass) Constructs a new instance. the obtained value from an empty cell isnull. -
Method Summary
Modifier and TypeMethodDescriptionexcelTableToBeanList(String filePath) Obtains excel table in the form ofList<PoiStringTableBean>.readToBean(String filePath) Obtains excel table in the form ofList<PoiStringTableBean>and validate obtained values..Methods inherited from class jp.ecuacion.util.poi.excel.table.reader.concrete.StringOneLineHeaderExcelTableReader
getHeaderLabels, getNoDataStringMethods inherited from class jp.ecuacion.util.poi.excel.table.reader.ExcelTableReader
getExcelReadUtil, getTableColumnSize, getTableRowSize, read, setTableColumnSizeMethods inherited from class jp.ecuacion.util.poi.excel.table.ExcelTable
getPoiBasisDeterminedTableStartColumnNumber, getPoiBasisDeterminedTableStartRowNumber, getSheetNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jp.ecuacion.util.poi.excel.table.IfDataTypeStringExcelTable
getStringValueMethods inherited from interface jp.ecuacion.util.poi.excel.table.reader.IfDataTypeStringExcelTableReader
getCellData, isCellDataEmptyMethods inherited from interface jp.ecuacion.util.poi.excel.table.IfExcelTable
getSheetNameMethods inherited from interface jp.ecuacion.util.poi.excel.table.reader.IfExcelTableReader
getExcelReadUtilMethods inherited from interface jp.ecuacion.util.poi.excel.table.IfFormatOneLineHeaderExcelTable
getFarLeftHeaderLabel, validateHeaderMethods inherited from interface jp.ecuacion.util.poi.excel.table.reader.IfFormatOneLineHeaderExcelTableReader
updateAndGetHeaderList
-
Constructor Details
-
StringOneLineHeaderExcelTableToBeanReader
public StringOneLineHeaderExcelTableToBeanReader(Class<?> beanClass, @RequireNonnull String sheetName, @RequireNonnull String[] headerLabels, Integer tableStartRowNumber, int tableStartColumnNumber, Integer tableRowSize, T... parameterClass) Constructs a new instance. the obtained value from an empty cell isnull.In most cases
nullis recommended becauseBean Validationannotations (likeMax) returns valid fornull, but invalid for"".- Parameters:
beanClass- the class of the generic parameterTis hard to obtain especially the constructor of this class is called directly with setting a class instead of T, likeList<Foo> list = new StringOneLineHeaderExcelTableToBeanReader<Foo>(...).
See here.
-
StringOneLineHeaderExcelTableToBeanReader
public StringOneLineHeaderExcelTableToBeanReader(Class<?> beanClass, @RequireNonnull String sheetName, @RequireNonnull String[] headerLabels, Integer tableStartRowNumber, int tableStartColumnNumber, Integer tableRowSize, @Nonnull NoDataString noDataString) Constructs a new instance with the obtained value from an empty cell.- Parameters:
beanClass- the class of the generic parameterTis hard to obtain especially the constructor of this class is called directly with setting a class instead of T, likeList<Foo> list = new StringOneLineHeaderExcelTableToBeanReader<Foo>(...).
See here.noDataString- the obtained value from an empty cell.nullor"".
-
-
Method Details
-
readToBean
public List<T> readToBean(String filePath) throws jp.ecuacion.lib.core.exception.checked.AppException, org.apache.poi.EncryptedDocumentException, IOException Obtains excel table in the form ofList<PoiStringTableBean>and validate obtained values..- Parameters:
filePath- excelPath- Returns:
- the list of
PoiStringTableBean. - Throws:
jp.ecuacion.lib.core.exception.checked.AppException- AppExceptionorg.apache.poi.EncryptedDocumentException- EncryptedDocumentExceptionIOException- IOException
-
excelTableToBeanList
protected List<T> excelTableToBeanList(String filePath) throws jp.ecuacion.lib.core.exception.checked.AppException, IOException Obtains excel table in the form ofList<PoiStringTableBean>.Since
readmethod contains validation function, you may want to test the validations. Although you don't want to prepare excel files to test each case.
When that's the case, you can skip the preparation of excel files by overriding this method and return list you want to test.- Throws:
jp.ecuacion.lib.core.exception.checked.AppExceptionIOException
-