public abstract class CsvItemReaderWriterBase extends ItemReaderWriterBase
CsvItemReader
and CsvItemWriter
.
This class also holds common CSV-related batch artifact properties.CsvItemReader
,
CsvItemWriter
Modifier and Type | Field and Description |
---|---|
protected Class |
beanType
Specifies a fully-qualified class or interface name that maps to a row of the source CSV file.
|
protected org.supercsv.cellprocessor.ift.CellProcessor[] |
cellProcessorInstances |
protected String |
cellProcessors
Specifies a list of cell processors, one for each column.
|
protected String |
charset
The name of the character set to be used for reading and writing data, e.g., UTF-8.
|
protected String |
commentMatcher
Specifies a
CommentMatcher for reading CSV resource. |
protected String |
delimiterChar
The delimiter character (separates each cell in a row).
|
protected String |
encoder
Specifies a custom encoder when writing CSV.
|
protected String |
endOfLineSymbols
The end of line symbols to use when writing (Windows, Mac and Linux style line breaks are all supported when
reading, so this preference won't be used at all for reading).
|
protected String[] |
nameMapping
Specify the bean fields or map keys corresponding to CSV columns.
|
protected String |
preference
Specifies one of the 4 predefined CSV preferences:
STANDARD_PREFERENCE
EXCEL_PREFERENCE
EXCEL_NORTH_EUROPE_PREFERENCE
TAB_PREFERENCE
|
protected String |
quoteChar
The quote character (used when a cell contains special characters, such as the delimiter char, a quote char,
or spans multiple lines).
|
protected String |
quoteMode
Allows you to enable surrounding quotes for writing (if a column wouldn't normally be quoted because
it doesn't contain special characters).
|
protected String |
surroundingSpacesNeedQuotes
Whether spaces surrounding a cell need quotes in order to be preserved (see below).
|
NEW_LINE, resource, skipBeanValidation
Constructor and Description |
---|
CsvItemReaderWriterBase() |
Modifier and Type | Method and Description |
---|---|
protected org.supercsv.cellprocessor.ift.CellProcessor[] |
getCellProcessors()
Gets the cell processors for reading CSV resource.
|
protected org.supercsv.comment.CommentMatcher |
getCommentMatcher(String val)
Gets the configured
org.supercsv.comment.CommentMatcher . |
protected org.supercsv.prefs.CsvPreference |
getCsvPreference()
Creates or obtains
org.supercsv.prefs.CsvPreference according to the configuration in JSL document. |
protected org.supercsv.encoder.CsvEncoder |
getEncoder(String val)
Gets the configured
org.supercsv.encoder.CsvEncoder . |
protected String[] |
getNameMapping()
Gets the field names of the target bean, if they differ from the CSV header, or if there is no CSV header.
|
protected org.supercsv.quote.QuoteMode |
getQuoteMode(String val)
Gets the configured
org.supercsv.quote.QuoteMode . |
getInputStream, getOutputStream, getValidator, validate
@Inject protected String[] nameMapping
getNameMapping()
@Inject protected Class beanType
java.util.List
java.util.Map
org.jberet.support.io.Person
my.own.BeanType
@Inject protected String preference
STANDARD_PREFERENCE
EXCEL_PREFERENCE
EXCEL_NORTH_EUROPE_PREFERENCE
TAB_PREFERENCE
getCsvPreference()
@Inject protected String quoteChar
@Inject protected String delimiterChar
@Inject protected String endOfLineSymbols
@Inject protected String surroundingSpacesNeedQuotes
@Inject protected String commentMatcher
CommentMatcher
for reading CSV resource. The CommentMatcher
determines whether a line should be considered a comment. For example,
getCommentMatcher(String)
@Inject protected String encoder
getEncoder(String)
@Inject protected String quoteMode
getQuoteMode(String)
@Inject protected String cellProcessors
For example, to specify cell processors for 5-column CSV:
value = " null; Optional, StrMinMax(1, 20); ParseLong; NotNull; Optional, ParseDate('dd/MM/yyyy') "
getCellProcessors()
@Inject protected String charset
protected org.supercsv.cellprocessor.ift.CellProcessor[] cellProcessorInstances
protected org.supercsv.prefs.CsvPreference getCsvPreference()
org.supercsv.prefs.CsvPreference
according to the configuration in JSL document.protected org.supercsv.cellprocessor.ift.CellProcessor[] getCellProcessors()
protected String[] getNameMapping()
protected org.supercsv.quote.QuoteMode getQuoteMode(String val)
org.supercsv.quote.QuoteMode
.val
- property value of quoteMode property in this batch artifact. For example,
protected org.supercsv.encoder.CsvEncoder getEncoder(String val)
org.supercsv.encoder.CsvEncoder
.val
- property value of encoder property in this batch artifact. For example,
CsvEncoder
protected org.supercsv.comment.CommentMatcher getCommentMatcher(String val)
org.supercsv.comment.CommentMatcher
.val
- property value of commentMatcher property in this batch artifact. For example,
CommentMatcher
Copyright © 2018 JBoss by Red Hat. All rights reserved.