Class ExcelTableReader<T>
- Type Parameters:
T- SeeIfExcelTable.
- All Implemented Interfaces:
IfExcelTable<T>,IfExcelTableReader<T>
- Direct Known Subclasses:
CellFreeExcelTableReader,CellOneLineHeaderExcelTableReader,StringExcelTableReader
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classProvidesIterable.static classProvides Iterator.Nested classes/interfaces inherited from class jp.ecuacion.util.poi.excel.table.ExcelTable
ExcelTable.ContextContainer -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ExcelReadUtilprotected @Min(1L) IntegerIs the column size of the table.protected @Min(1L) IntegerIs the row size of the table.Fields inherited from class jp.ecuacion.util.poi.excel.table.ExcelTable
ignoresAdditionalColumnsOfHeaderData, sheetName, tableStartColumnNumber, tableStartRowNumber -
Constructor Summary
ConstructorsConstructorDescriptionExcelTableReader(String sheetName, Integer tableStartRowNumber, int tableStartColumnNumber, Integer tableRowSize, Integer tableColumnSize) Constructs a new instance with the sheet name, the position and the size of the excel table. -
Method Summary
Modifier and TypeMethodDescriptionReturns an instance ofExcelReadUtil.getIterable(org.apache.poi.ss.usermodel.Workbook workbook) Provides anIterablereader.getTableColumnSize(org.apache.poi.ss.usermodel.Sheet sheet, int poiBasisDeterminedTableStartRowNumber, int poiBasisDeterminedTableStartColumnNumber, boolean ignoresColumnSizeSetInReader) Returns tableColumnSize.Returns tableRowSize, may benull.ignoresAdditionalColumnsOfHeaderData(boolean value) Stores the boolean value which indicates whethervalidateHeaderDataignores additional header columns.Reads a table data in an excel file atexcelPathand Return it in the form ofList<List<T>>.read(org.apache.poi.ss.usermodel.Workbook workbook) Reads a table data in an excel file atfilePathand Return it in the form ofList<List<T>>.voidsetTableColumnSize(int tableColumnSize) setstableColumnSize.suppressesWarnLog(boolean suppressesWarnLog) SetssuppressesWarnLog.Methods inherited from class jp.ecuacion.util.poi.excel.table.ExcelTable
getPoiBasisDeterminedTableStartColumnNumber, getPoiBasisDeterminedTableStartRowNumber, getSheetName, ignoresAdditionalColumnsOfHeaderDataMethods 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.IfExcelTable
getFarLeftAndTopHeaderLabel, getHeaderLabelData, getNumberOfHeaderLines, getSheetName, getStringValue, ignoresAdditionalColumnsOfHeaderData, validateHeaderDataMethods inherited from interface jp.ecuacion.util.poi.excel.table.reader.IfExcelTableReader
getCellData, isCellDataEmpty, updateAndGetHeaderData
-
Field Details
-
readUtil
-
tableRowSizeGivenByConstructor
Is the row size of the table.It's equal to or greater than
1.
0or the number smaller than that is not acceptable.
nullis acceptable, which meanstableRowSizeis decided for the program to find an empty row.
When the table has a header, the row size includes the header line, -
tableColumnSizeGivenByConstructor
Is the column size of the table.It's equal to or greater than
1.
0or the number smaller than that is not acceptable.
nullis acceptable, which meanstableColumnSizeis decided by the length of the header. Empty header cell means it's the end of the header.
When the table has a header, the row size includes the header line,
-
-
Constructor Details
-
ExcelTableReader
public ExcelTableReader(@RequireNonnull String sheetName, @Nullable Integer tableStartRowNumber, int tableStartColumnNumber, @Nullable Integer tableRowSize, @Nullable Integer tableColumnSize) Constructs a new instance with the sheet name, the position and the size of the excel table.- Parameters:
sheetName- SeeExcelTable.sheetName.tableStartRowNumber- SeeExcelTable.tableStartRowNumber.tableStartColumnNumber- SeeExcelTable.tableStartColumnNumber.tableRowSize- SeetableRowSizeGivenByConstructor.tableColumnSize- SeetableColumnSizeGivenByConstructor.
-
-
Method Details
-
read
@Nonnull public List<List<T>> read(@RequireNonnull String filePath) throws org.apache.poi.EncryptedDocumentException, jp.ecuacion.lib.core.exception.checked.AppException, IOException Reads a table data in an excel file atexcelPathand Return it in the form ofList<List<T>>.The internal
List<T>stores data in one line.
The externalListstores lines ofList<T>.- Parameters:
filePath- filePath- Throws:
IOException- IOExceptionjp.ecuacion.lib.core.exception.checked.AppException- AppExceptionorg.apache.poi.EncryptedDocumentException- EncryptedDocumentException
-
read
@Nonnull public List<List<T>> read(@RequireNonnull org.apache.poi.ss.usermodel.Workbook workbook) throws org.apache.poi.EncryptedDocumentException, jp.ecuacion.lib.core.exception.checked.AppException, IOException Reads a table data in an excel file atfilePathand Return it in the form ofList<List<T>>.The internal
List<T>stores data in one line.
The externalListstores lines ofList<T>.- Parameters:
workbook- workbook It's used only to write down to the log so if getting the filePath is hard, filename or whatever else is fine.- Throws:
IOException- IOExceptionjp.ecuacion.lib.core.exception.checked.AppException- AppExceptionorg.apache.poi.EncryptedDocumentException- EncryptedDocumentException
-
getIterable
@Nonnull public Iterable<List<T>> getIterable(@RequireNonnull org.apache.poi.ss.usermodel.Workbook workbook) throws org.apache.poi.EncryptedDocumentException, jp.ecuacion.lib.core.exception.checked.AppException, IOException Provides anIterablereader.The internal
List<T>stores data in one line.
The externalListstores lines ofList<T>.- Parameters:
workbook- workbook It's used only to write down to the log so if getting the filePath is hard, filename or whatever else is fine.- Throws:
IOException- IOExceptionjp.ecuacion.lib.core.exception.checked.AppException- AppExceptionorg.apache.poi.EncryptedDocumentException- EncryptedDocumentException
-
getTableRowSize
Returns tableRowSize, may benull. -
getTableColumnSize
@Nonnull public Integer getTableColumnSize(@RequireNonnull org.apache.poi.ss.usermodel.Sheet sheet, int poiBasisDeterminedTableStartRowNumber, int poiBasisDeterminedTableStartColumnNumber, boolean ignoresColumnSizeSetInReader) throws jp.ecuacion.lib.core.exception.checked.BizLogicAppException Returns tableColumnSize.- Parameters:
sheet- sheetpoiBasisDeterminedTableStartRowNumber- poiBasisDeterminedTableStartRowNumberpoiBasisDeterminedTableStartColumnNumber- poiBasisDeterminedTableStartRowNumber- Throws:
jp.ecuacion.lib.core.exception.checked.BizLogicAppException- BizLogicAppException
-
setTableColumnSize
public void setTableColumnSize(int tableColumnSize) setstableColumnSize.tableColumnSize can be set by the header length, but the instance method cannot be called from constructors so the setter is needed.
This method set the final value of the column size, so the argument is not
Integer, but primitiveint.- Parameters:
tableColumnSize- tableColumnSize.
-
getExcelReadUtil
Description copied from interface:IfExcelTableReaderReturns an instance ofExcelReadUtil.- Specified by:
getExcelReadUtilin interfaceIfExcelTableReader<T>- Returns:
ExcelReadUtilinstance
-
suppressesWarnLog
SetssuppressesWarnLog.- Parameters:
suppressesWarnLog- suppressesWarnLog- Returns:
ExcelTableReader<T>
-
ignoresAdditionalColumnsOfHeaderData
Description copied from interface:IfExcelTableStores the boolean value which indicates whethervalidateHeaderDataignores additional header columns.- Specified by:
ignoresAdditionalColumnsOfHeaderDatain interfaceIfExcelTable<T>- Parameters:
value- boolean
-