
@Named @Dependent public class JsonItemReader extends JsonItemReaderWriterBase implements javax.batch.api.chunk.ItemReader
javax.batch.api.chunk.ItemReader that reads from Json resource that consists of a
collection of same-typed data items. Its readItem() method reads one item at a time, and binds it to a
user-provided bean type that represents individual data item in the source Json resource. The data item may also
be bound to java.util.Map or com.fasterxml.jackson.databind.JsonNode for applications that do not
need application bean type.JsonItemWriter,
JsonItemReaderWriterBase| Modifier and Type | Field and Description |
|---|---|
protected Class |
beanType
The bean type that represents individual data item in the source Json
ItemReaderWriterBase.resource. |
protected String |
deserializationProblemHandlers
A comma-separated list of fully-qualified names of classes that implement
com.fasterxml.jackson.databind.deser.DeserializationProblemHandler, which can be registered to get
called when a potentially recoverable problem is encountered during deserialization process. |
protected int |
end
Specify the end position in the data set (inclusive).
|
protected Class |
inputDecorator
Fully-qualified name of a class that extends
com.fasterxml.jackson.core.io.InputDecorator, which can be
used to decorate input sources. |
protected com.fasterxml.jackson.core.JsonParser |
jsonParser |
protected Map<String,String> |
jsonParserFeatures
A comma-separated list of key-value pairs that specify
com.fasterxml.jackson.core.JsonParser features. |
protected int |
rowNumber |
protected int |
start
Specifies the start position (a positive integer starting from 1) to read the data.
|
customDataTypeModules, customDeserializers, customSerializers, deserializationFeatures, jsonFactory, jsonFactoryFeatures, jsonFactoryLookup, mapperFeatures, objectMapper, serializationFeaturesNEW_LINE, resource, skipBeanValidation| Constructor and Description |
|---|
JsonItemReader() |
| Modifier and Type | Method and Description |
|---|---|
Serializable |
checkpointInfo() |
void |
close() |
protected static com.fasterxml.jackson.core.JsonParser |
configureJsonParser(JsonItemReaderWriterBase batchReaderArtifact,
Class<?> inputDecorator,
String deserializationProblemHandlers,
Map<String,String> jsonParserFeatures) |
void |
open(Serializable checkpoint) |
Object |
readItem() |
initJsonFactory, initJsonFactoryAndObjectMapper, registerModulegetInputStream, getOutputStream, getValidator, validate@Inject protected Class beanType
ItemReaderWriterBase.resource. Required property, and
valid values are:
org.jberet.support.io.StockTrade
java.util.Map
com.fasterxml.jackson.databind.JsonNode
@Inject protected int start
@Inject protected int end
Integer.MAX_VALUE.
If reading till the end of the input Json resource, there is no need to specify this property.@Inject protected Map<String,String> jsonParserFeatures
com.fasterxml.jackson.core.JsonParser features.
Optional property and defaults to null. For example,
ALLOW_COMMENTS=true, ALLOW_YAML_COMMENTS=true, ALLOW_NUMERIC_LEADING_ZEROS=true, STRICT_DUPLICATE_DETECTION=true
@Inject protected String deserializationProblemHandlers
com.fasterxml.jackson.databind.deser.DeserializationProblemHandler, which can be registered to get
called when a potentially recoverable problem is encountered during deserialization process.
Handlers can try to resolve the problem, throw an exception or do nothing. Optional property and defaults to null.
For example,
org.jberet.support.io.JsonItemReaderTest$UnknownHandler, org.jberet.support.io.JsonItemReaderTest$UnknownHandler2
MappingJsonFactoryObjectFactory.configureDeserializationProblemHandlers(com.fasterxml.jackson.databind.ObjectMapper, java.lang.String, java.lang.ClassLoader)@Inject protected Class inputDecorator
com.fasterxml.jackson.core.io.InputDecorator, which can be
used to decorate input sources. Typical use is to use a filter abstraction (filtered stream, reader)
around original input source, and apply additional processing during read operations. Optional property and
defaults to null. For example,
org.jberet.support.io.JsonItemReaderTest$NoopInputDecorator
protected com.fasterxml.jackson.core.JsonParser jsonParser
protected int rowNumber
public void open(Serializable checkpoint) throws Exception
open in interface javax.batch.api.chunk.ItemReaderExceptionpublic Object readItem() throws Exception
readItem in interface javax.batch.api.chunk.ItemReaderExceptionpublic Serializable checkpointInfo() throws Exception
checkpointInfo in interface javax.batch.api.chunk.ItemReaderExceptionpublic void close()
throws Exception
close in interface javax.batch.api.chunk.ItemReaderExceptionCopyright © 2018 JBoss by Red Hat. All rights reserved.