|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- public interface CsvCallback<T>
Provides callback methods for customisation of CSV processing.
You can provide your own CsvCallback implementation to customise the CSV processing. It is expected that the DefaultCsvCallback provides a good base class that you can extend.
Method Summary | |
---|---|
void |
begin(EbeanServer server)
The processing is about to begin. |
void |
end(int row)
The processing has ended successfully. |
void |
endWithError(int row,
Exception e)
The processing has ended due to an error. |
void |
processBean(int row,
String[] line,
T bean)
Called for each bean after it has been loaded from the CSV content. |
boolean |
processLine(int row,
String[] line)
Check that the row should be processed - return true to process the row or false to ignore the row. |
void |
readHeader(String[] line)
Read the header row. |
Method Detail |
---|
void begin(EbeanServer server)
Typically the callback will create a transaction, set batch mode, batch size etc.
void readHeader(String[] line)
This is only called if CsvReader.setHasHeader(boolean)
has been
set to true.
line
- the header line content.boolean processLine(int row, String[] line)
void processBean(int row, String[] line, T bean)
This allows you to process the bean however you like.
When you use a CsvCallback the CsvReader *WILL NOT* create a transaction and will not save the bean for you. You have complete control and must do these things yourself (if that is want you want).
row
- the index of the content being processedline
- the content that has been used to load the beanbean
- the entity bean after it has been loaded from the csv contentvoid end(int row)
Typically the callback will commit the transaction.
void endWithError(int row, Exception e)
This gives the callback the opportunity to rollback the transaction if one was created.
row
- the row that the error has occured one
- the error that occured
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |