@Named @Dependent public class XmlItemReader extends XmlItemReaderWriterBase implements javax.batch.api.chunk.ItemReader
javax.batch.api.chunk.ItemReader
that reads a collection of data from XML resource.
Users of this class should provide a bean class that represents individual data item in the source XML, and the
readItem()
method reads one item at a time and binds it to the provided bean type.XmlItemWriter
,
XmlItemReaderWriterBase
Modifier and Type | Field and Description |
---|---|
protected Class |
beanType
The bean class that represents individual data item in the
ItemReaderWriterBase.resource XML, and the readItem()
method reads one item at a time and binds it to the provided bean type. |
protected int |
end
Specify the end position in the data set (inclusive).
|
protected Class |
inputDecorator
Fully-qualified name of a class implementing
com.fasterxml.jackson.core.io.InputDecorator , which
can be used to decorate input sources. |
protected int |
start
Specifies the start position (a positive integer starting from 1) to read the data.
|
protected String |
xmlTextElementName
Alternate "virtual name" to use for XML CDATA segments; that is, text values.
|
customDataTypeModules, xmlFactory, xmlFactoryLookup, xmlMapper, xmlModule
NEW_LINE, resource, skipBeanValidation
Constructor and Description |
---|
XmlItemReader() |
Modifier and Type | Method and Description |
---|---|
Serializable |
checkpointInfo() |
void |
close() |
protected void |
initXmlModule()
Initializes
XmlItemReaderWriterBase.xmlModule , if needed by job xml configuration. |
void |
open(Serializable checkpoint) |
Object |
readItem() |
initXmlFactory
getInputStream, getOutputStream, getValidator, validate
@Inject protected Class beanType
ItemReaderWriterBase.resource
XML, and the readItem()
method reads one item at a time and binds it to the provided bean type. Required property. For example,
org.jberet.support.io.StockTrade
org.jberet.support.io.Person
my.own.custom.ItemBean
@Inject protected int start
@Inject protected int end
Integer.MAX_VALUE
.
If reading till the end of the input XML, there is no need to specify this property.@Inject protected Class inputDecorator
com.fasterxml.jackson.core.io.InputDecorator
, which
can be used to decorate input sources. Optional property, and defaults to null.@Inject protected String xmlTextElementName
public void open(Serializable checkpoint) throws Exception
open
in interface javax.batch.api.chunk.ItemReader
Exception
public Object readItem() throws Exception
readItem
in interface javax.batch.api.chunk.ItemReader
Exception
public Serializable checkpointInfo() throws Exception
checkpointInfo
in interface javax.batch.api.chunk.ItemReader
Exception
public void close() throws Exception
close
in interface javax.batch.api.chunk.ItemReader
Exception
protected void initXmlModule()
XmlItemReaderWriterBase
XmlItemReaderWriterBase.xmlModule
, if needed by job xml configuration.initXmlModule
in class XmlItemReaderWriterBase
Copyright © 2018 JBoss by Red Hat. All rights reserved.