|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.item.ItemStreamSupport
org.springframework.batch.item.support.AbstractItemStreamItemReader<T>
org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
org.springframework.batch.item.excel.AbstractExcelItemReader<T>
T - the typepublic abstract class AbstractExcelItemReader<T>
ItemReader implementation to read an Excel
file. It will read the file sheet for sheet and row for row. It is loosy based on
the FlatFileItemReader
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
logger
|
| Constructor Summary | |
|---|---|
AbstractExcelItemReader()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
protected void |
doClose()
|
protected void |
doOpen()
|
protected T |
doRead()
|
protected abstract int |
getNumberOfSheets()
The number of sheets in the underlying workbook. |
protected abstract Sheet |
getSheet(int sheet)
|
protected void |
jumpToItem(int itemIndex)
On restart this will increment rowSet to where job left off previously |
protected abstract void |
openExcelFile(org.springframework.core.io.Resource resource)
|
T |
read()
|
void |
setEndAfterBlankLines(int endAfterBlankLines)
|
void |
setLinesToSkip(int linesToSkip)
Set the number of lines to skip. |
void |
setResource(org.springframework.core.io.Resource resource)
Public setter for the input resource. |
void |
setRowMapper(RowMapper<T> rowMapper)
Public setter for the rowMapper. |
void |
setRowSetFactory(RowSetFactory rowSetFactory)
Public setter for the rowSetFactory. |
void |
setSkippedRowsCallback(RowCallbackHandler skippedRowsCallback)
|
void |
setStrict(boolean strict)
In strict mode the reader will throw an exception on AbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext) if the input resource does not exist. |
| Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader |
|---|
close, getCurrentItemCount, isSaveState, open, setCurrentItemCount, setMaxItemCount, setSaveState, update |
| Methods inherited from class org.springframework.batch.item.ItemStreamSupport |
|---|
getExecutionContextKey, setExecutionContextName, setName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.springframework.batch.item.ItemStream |
|---|
close, open, update |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log logger
| Constructor Detail |
|---|
public AbstractExcelItemReader()
| Method Detail |
|---|
public T read()
throws Exception,
org.springframework.batch.item.UnexpectedInputException,
org.springframework.batch.item.ParseException
read in interface org.springframework.batch.item.ItemReader<T>read in class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>Exception
org.springframework.batch.item.UnexpectedInputException
org.springframework.batch.item.ParseException
protected T doRead()
throws Exception
doRead in class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>setRowMapper(RowMapper) (might span multiple rows in file).
Exception
protected void jumpToItem(int itemIndex)
throws Exception
jumpToItem in class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>Exception
protected void doOpen()
throws Exception
doOpen in class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>Exception
protected void doClose()
throws Exception
doClose in class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>Exceptionpublic void setResource(org.springframework.core.io.Resource resource)
setResource in interface org.springframework.batch.item.file.ResourceAwareItemReaderItemStream<T>resource - the Resource pointing to the Excelfile
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic void setLinesToSkip(int linesToSkip)
linesToSkip - number of lines to skipprotected abstract Sheet getSheet(int sheet)
sheet - the sheet index
null when no sheet available.protected abstract int getNumberOfSheets()
protected abstract void openExcelFile(org.springframework.core.io.Resource resource)
throws Exception
resource - Resource pointing to the Excel file to read
Exception - when the Excel sheet cannot be accessedpublic void setStrict(boolean strict)
AbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext) if the input resource does not exist.
strict - true by defaultpublic void setRowMapper(RowMapper<T> rowMapper)
rowMapper. Used to map a row read from the underlying Excel workbook.
rowMapper - the RowMapper to use.public void setRowSetFactory(RowSetFactory rowSetFactory)
rowSetFactory. Used to create a RowSet implemenation. By default the
DefaultRowSetFactory is used.
rowSetFactory - the RowSetFactory to use.public void setSkippedRowsCallback(RowCallbackHandler skippedRowsCallback)
skippedRowsCallback - will be called for each one of the initial skipped lines before any items are read.public void setEndAfterBlankLines(int endAfterBlankLines)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||