|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.bstoi.poiparser.core.strategy.AbstractPoiFileParser<T>
public abstract class AbstractPoiFileParser<T>
| Constructor Summary | |
|---|---|
AbstractPoiFileParser()
|
|
AbstractPoiFileParser(Map<String,Integer> columnFieldNameMapping)
|
|
AbstractPoiFileParser(Map<String,Integer> columnFieldNameMapping,
Set<Integer> requiredFields)
|
|
| Method Summary | |
|---|---|
void |
addColumnFieldNameMapping(String fieldName,
Integer columnNumber)
Add a mapping for a column |
void |
addReadIgnoreColumn(Integer columnNumber)
Add a column number for ignoring when reading. |
void |
addRequiredField(Integer columnNumber)
Add the column number for a required field |
void |
addWriteIgnoreColumn(Integer columnNumber)
Add a column number for ignoring when writing. |
Map<String,Integer> |
getColumnFieldNameMapping()
|
DefaultConverterFactory |
getDefaultConverterFactory()
|
Map<String,String> |
getHeaderFieldNameTranslationMapping()
|
Set<Integer> |
getReadIgnoreColumns()
|
Set<Integer> |
getWriteIgnoreColumns()
|
boolean |
ignoreRow(org.apache.poi.ss.usermodel.Row row)
If row is empty, the ignore empty row setting will determine the adding of the row. |
boolean |
isEmptyRow(org.apache.poi.ss.usermodel.Row row)
Check whether a row is empty based on the column values |
boolean |
isEmptyValue(org.apache.poi.ss.usermodel.Cell cell)
Check if the hssfCell is empty or blank |
boolean |
isIgnoreEmptyRows()
|
boolean |
isIgnoreFirstRow()
|
boolean |
isRemoveWriteIgnoreColumns()
If columns that are ignored must be deleted from the sheet when writing. |
abstract List<T> |
readExcelFile(File excelFile,
String sheetName,
Class<T> clazz)
|
abstract List<T> |
readExcelFile(File excelFile,
String sheetName,
Class<T> clazz,
int startRow)
Read a excel file from start row to last row. |
abstract List<T> |
readExcelFile(File excelFile,
String sheetName,
Class<T> clazz,
int startRow,
int endRow)
Read a excel file from start row to end row |
abstract List<T> |
readExcelFile(InputStream inputStream,
String sheetName,
Class<T> clazz)
|
abstract List<T> |
readExcelFile(InputStream inputStream,
String sheetName,
Class<T> clazz,
int startRow)
Read a excel file input stream from given start row until last row |
abstract List<T> |
readExcelFile(InputStream inputStream,
String sheetName,
Class<T> clazz,
int startRow,
int endRow)
Read a excel file inputstream start row to end row |
protected void |
readField(String sheetName,
org.apache.poi.ss.usermodel.Row row,
T rowDimension,
String fieldName)
Read a specific field and fill it with the value in the excel |
protected T |
readRow(String sheetName,
org.apache.poi.ss.usermodel.Row row,
T rowDimension)
Read a excel row and convert the selected field into a row dimension |
protected List<T> |
readSheet(org.apache.poi.ss.usermodel.Sheet sheet,
Class<T> clazz)
Read Excel sheet. |
protected List<T> |
readSheet(org.apache.poi.ss.usermodel.Sheet sheet,
Class<T> clazz,
int startRow)
|
protected List<T> |
readSheet(org.apache.poi.ss.usermodel.Sheet sheet,
Class<T> clazz,
int startRow,
int endRow)
|
protected void |
remapColumnFieldMapForWriting()
Re-map the columns when empty columns are ignored |
void |
setHeaderFieldNameTranslationMapping(Map<String,String> headerFieldNameTranslationMapping)
|
void |
setIgnoreEmptyRows(boolean ignoreEmptyRows)
|
void |
setIgnoreFirstRow(boolean ignoreFirstRow)
|
void |
setRemoveWriteIgnoreColumns(boolean removeWriteIgnoreColumns)
Set if the parser deletes the columns when writing a sheet. |
protected void |
validateColumnFieldMapForWriting()
Validate if columns are used more than once. |
protected void |
writeCell(org.apache.poi.ss.usermodel.Row row,
T dimension,
String fieldName)
|
abstract void |
writeExcelFile(OutputStream outputStream,
LinkedHashMap<String,List<T>> excelDataMap,
Class<T> clazz)
|
protected void |
writeHeaderRow(org.apache.poi.ss.usermodel.Sheet sheet,
Integer rowNumber)
|
protected void |
writeRow(org.apache.poi.ss.usermodel.Sheet sheet,
T dimension,
Integer rowNumber)
|
protected void |
writeSheet(org.apache.poi.ss.usermodel.Workbook workbook,
String sheetName,
List<T> dimensionList)
|
protected org.apache.poi.ss.usermodel.Workbook |
writeWorkbook(LinkedHashMap<String,List<T>> excelDataMap)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractPoiFileParser()
public AbstractPoiFileParser(Map<String,Integer> columnFieldNameMapping)
public AbstractPoiFileParser(Map<String,Integer> columnFieldNameMapping,
Set<Integer> requiredFields)
| Method Detail |
|---|
public abstract List<T> readExcelFile(File excelFile,
String sheetName,
Class<T> clazz)
throws IOException,
FileNotFoundException,
InstantiationException,
IllegalAccessException,
RequiredFieldPoiParserException,
ReadPoiParserException
IOException
FileNotFoundException
InstantiationException
IllegalAccessException
RequiredFieldPoiParserException
ReadPoiParserException
public abstract List<T> readExcelFile(InputStream inputStream,
String sheetName,
Class<T> clazz)
throws IOException,
FileNotFoundException,
InstantiationException,
IllegalAccessException,
RequiredFieldPoiParserException,
ReadPoiParserException
IOException
FileNotFoundException
InstantiationException
IllegalAccessException
RequiredFieldPoiParserException
ReadPoiParserException
public abstract List<T> readExcelFile(File excelFile,
String sheetName,
Class<T> clazz,
int startRow,
int endRow)
throws IOException,
FileNotFoundException,
InstantiationException,
IllegalAccessException,
RequiredFieldPoiParserException,
ReadPoiParserException
excelFile - sheetName - clazz - startRow - endRow -
IOException
FileNotFoundException
InstantiationException
IllegalAccessException
RequiredFieldPoiParserException
ReadPoiParserException
public abstract List<T> readExcelFile(File excelFile,
String sheetName,
Class<T> clazz,
int startRow)
throws IOException,
FileNotFoundException,
InstantiationException,
IllegalAccessException,
RequiredFieldPoiParserException,
ReadPoiParserException
excelFile - sheetName - clazz - startRow -
IOException
FileNotFoundException
InstantiationException
IllegalAccessException
RequiredFieldPoiParserException
ReadPoiParserException
public abstract List<T> readExcelFile(InputStream inputStream,
String sheetName,
Class<T> clazz,
int startRow,
int endRow)
throws IOException,
FileNotFoundException,
InstantiationException,
IllegalAccessException,
RequiredFieldPoiParserException,
ReadPoiParserException
inputStream - sheetName - clazz - startRow - endRow -
IOException
FileNotFoundException
InstantiationException
IllegalAccessException
RequiredFieldPoiParserException
ReadPoiParserException
public abstract List<T> readExcelFile(InputStream inputStream,
String sheetName,
Class<T> clazz,
int startRow)
throws IOException,
FileNotFoundException,
InstantiationException,
IllegalAccessException,
RequiredFieldPoiParserException,
ReadPoiParserException
inputStream - sheetName - clazz - startRow -
IOException
FileNotFoundException
InstantiationException
IllegalAccessException
RequiredFieldPoiParserException
ReadPoiParserException
public abstract void writeExcelFile(OutputStream outputStream,
LinkedHashMap<String,List<T>> excelDataMap,
Class<T> clazz)
throws IOException,
InitialWritePoiParserException,
WritePoiParserException
IOException
InitialWritePoiParserException
WritePoiParserException
protected List<T> readSheet(org.apache.poi.ss.usermodel.Sheet sheet,
Class<T> clazz)
throws InstantiationException,
IllegalAccessException,
RequiredFieldPoiParserException,
ReadPoiParserException
sheet - clazz -
InstantiationException
IllegalAccessException
RequiredFieldPoiParserException
ReadPoiParserException
protected List<T> readSheet(org.apache.poi.ss.usermodel.Sheet sheet,
Class<T> clazz,
int startRow)
throws InstantiationException,
IllegalAccessException,
RequiredFieldPoiParserException,
ReadPoiParserException
InstantiationException
IllegalAccessException
RequiredFieldPoiParserException
ReadPoiParserException
protected List<T> readSheet(org.apache.poi.ss.usermodel.Sheet sheet,
Class<T> clazz,
int startRow,
int endRow)
throws InstantiationException,
IllegalAccessException,
RequiredFieldPoiParserException,
ReadPoiParserException
InstantiationException
IllegalAccessException
RequiredFieldPoiParserException
ReadPoiParserException
protected T readRow(String sheetName,
org.apache.poi.ss.usermodel.Row row,
T rowDimension)
throws RequiredFieldPoiParserException,
ReadPoiParserException
Read a excel row and convert the selected field into a row dimension
row - rowDimension -
RequiredFieldPoiParserException
ReadPoiParserException
protected void readField(String sheetName,
org.apache.poi.ss.usermodel.Row row,
T rowDimension,
String fieldName)
throws RequiredFieldPoiParserException,
ReadPoiParserException
Read a specific field and fill it with the value in the excel
row - Excel rowrowDimension - Abstract representation of a rowfieldName - Name of a field in the class RequiredFieldPoiParserException
ReadPoiParserException
protected org.apache.poi.ss.usermodel.Workbook writeWorkbook(LinkedHashMap<String,List<T>> excelDataMap)
throws InitialWritePoiParserException,
WritePoiParserException
InitialWritePoiParserException
WritePoiParserException
protected void writeSheet(org.apache.poi.ss.usermodel.Workbook workbook,
String sheetName,
List<T> dimensionList)
throws WritePoiParserException
WritePoiParserException
protected void writeRow(org.apache.poi.ss.usermodel.Sheet sheet,
T dimension,
Integer rowNumber)
throws WritePoiParserException
WritePoiParserException
protected void writeHeaderRow(org.apache.poi.ss.usermodel.Sheet sheet,
Integer rowNumber)
protected void writeCell(org.apache.poi.ss.usermodel.Row row,
T dimension,
String fieldName)
throws WritePoiParserException
WritePoiParserExceptionpublic boolean ignoreRow(org.apache.poi.ss.usermodel.Row row)
hssfRow -
public boolean isEmptyRow(org.apache.poi.ss.usermodel.Row row)
hssfRow -
public boolean isEmptyValue(org.apache.poi.ss.usermodel.Cell cell)
hssfCell -
protected void validateColumnFieldMapForWriting()
throws InitialWritePoiParserException
InitialWritePoiParserException
protected void remapColumnFieldMapForWriting()
throws InitialWritePoiParserException
InitialWritePoiParserExceptionpublic boolean isIgnoreEmptyRows()
public void setIgnoreEmptyRows(boolean ignoreEmptyRows)
public void setIgnoreFirstRow(boolean ignoreFirstRow)
public boolean isIgnoreFirstRow()
public boolean isRemoveWriteIgnoreColumns()
public void setRemoveWriteIgnoreColumns(boolean removeWriteIgnoreColumns)
removeWriteIgnoreColumns - public Map<String,Integer> getColumnFieldNameMapping()
public Map<String,String> getHeaderFieldNameTranslationMapping()
public void setHeaderFieldNameTranslationMapping(Map<String,String> headerFieldNameTranslationMapping)
public void addColumnFieldNameMapping(String fieldName,
Integer columnNumber)
fieldName - columnNumber - public void addRequiredField(Integer columnNumber)
columnNumber - public void addReadIgnoreColumn(Integer columnNumber)
columnNumber - public void addWriteIgnoreColumn(Integer columnNumber)
columnNumber - public Set<Integer> getWriteIgnoreColumns()
public Set<Integer> getReadIgnoreColumns()
public DefaultConverterFactory getDefaultConverterFactory()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||