public abstract class JacksonCsvItemReaderWriterBase extends JsonItemReaderWriterBase
JacksonCsvItemReader
and JacksonCsvItemWriter
.JacksonCsvItemReader
,
JacksonCsvItemWriter
Modifier and Type | Field and Description |
---|---|
protected Class |
beanType
For
ItemReader , it's the java type that each data item should be converted to; for ItemWriter ,
it's the java type for each incoming data item. |
protected String |
columns
Specifies CSV schema in one of the 2 ways:
columns = "<fully-qualified class name>":
CSV schema is defined in the named POJO class, which typically has class-level annotation com.fasterxml.jackson.annotation.JsonPropertyOrder to define property order corresponding to
CSV column order. |
protected String |
columnSeparator
Character used to separate values.
|
protected com.fasterxml.jackson.dataformat.csv.CsvMapper |
csvMapper |
protected String |
nullValue
When asked to write Java `null`, this String value will be used instead.
|
protected String |
quoteChar
Character used for quoting values that contain quote characters or linefeeds.
|
protected boolean |
useHeader
whether the first line of physical document defines column names (true) or not (false):
if enabled, parser will take first-line values to define column names; and generator will output column names as
the first line.
|
customDataTypeModules, customDeserializers, customSerializers, deserializationFeatures, jsonFactory, jsonFactoryFeatures, jsonFactoryLookup, mapperFeatures, objectMapper, serializationFeatures
NEW_LINE, resource, skipBeanValidation
Constructor and Description |
---|
JacksonCsvItemReaderWriterBase() |
Modifier and Type | Method and Description |
---|---|
protected com.fasterxml.jackson.dataformat.csv.CsvSchema |
buildCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvSchema schema) |
protected void |
init() |
protected void |
initJsonFactory()
Initializes
JsonFactory or its subtypes, e.g., com.fasterxml.jackson.dataformat.xml.XmlFactory ,
or com.fasterxml.jackson.dataformat.csv.CsvFactory . |
initJsonFactoryAndObjectMapper, registerModule
getInputStream, getOutputStream, getValidator, validate
@Inject protected Class beanType
ItemReader
, it's the java type that each data item should be converted to; for ItemWriter
,
it's the java type for each incoming data item. In either case, the valid values are:
java.util.Map
java.util.List
java.lang.String[]
com.fasterxml.jackson.databind.JsonNode
When using java.util.List
or java.lang.String[]
for reading, it is deemed raw access, and CSV
schema will not be configured and any schema-related properties are ignored. Specifically, CSV header and
comment lines are read as raw access content.
@Inject protected String columns
com.fasterxml.jackson.annotation.JsonPropertyOrder
to define property order corresponding to
CSV column order.com.fasterxml.jackson.dataformat.csv.CsvSchema.ColumnType
, including:
com.fasterxml.jackson.dataformat.csv.CsvSchema.ColumnType
javadoc.
columns = "org.jberet.support.io.StockTrade" columns = "firstName STRING, lastName STRING, age NUMBER"In
JacksonCsvItemReader
, if this property is not defined and useHeader
is true
(CSV input has a header), the header is used to create CSV schema. However, when beanType
is
java.util.List
or java.lang.String[]
, the reader is considered raw access, and all schema-related
properties are ignored.
This property is optional for reader and required for writer class.@Inject protected boolean useHeader
For JacksonCsvItemReader
, if beanType
is java.util.List
or java.lang.String[]
,
it is considered raw access, useHeader
property is ignored and no CSV schema is used.
valid values are true
or false
, and the default is false
.
@Inject protected String quoteChar
@Inject protected String columnSeparator
@Inject protected String nullValue
protected com.fasterxml.jackson.dataformat.csv.CsvMapper csvMapper
protected void initJsonFactory() throws Exception
JsonItemReaderWriterBase
JsonFactory
or its subtypes, e.g., com.fasterxml.jackson.dataformat.xml.XmlFactory
,
or com.fasterxml.jackson.dataformat.csv.CsvFactory
. The factory should be initialized with a valid
ObjectMapper
.
Subclass may override this method to use different concrete types of JsonFactory
.initJsonFactory
in class JsonItemReaderWriterBase
Exception
Copyright © 2015 JBoss by Red Hat. All rights reserved.