类 StaxEventItemReaderBuilder<T>
- java.lang.Object
- org.springframework.batch.item.xml.builder.StaxEventItemReaderBuilder<T>
public class StaxEventItemReaderBuilder<T> extends java.lang.Object
A fluent builder for theStaxEventItemReader
- 从以下版本开始:
- 4.0
- 作者:
- Michael Minella, Glenn Renfro
构造器概要
构造器 构造器 说明 StaxEventItemReaderBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 StaxEventItemReaderBuilder<T>
addFragmentRootElements(java.lang.String... fragmentRootElements)
Adds the list of fragments to be used as the root of each chunk to the configuration.StaxEventItemReaderBuilder<T>
addFragmentRootElements(java.util.List<java.lang.String> fragmentRootElements)
Adds the list of fragments to be used as the root of each chunk to the configuration.StaxEventItemReader<T>
build()
Validates the configuration and builds a newStaxEventItemReader
StaxEventItemReaderBuilder<T>
currentItemCount(int currentItemCount)
Index for the current item.StaxEventItemReaderBuilder<T>
maxItemCount(int maxItemCount)
Configure the max number of items to be read.StaxEventItemReaderBuilder<T>
name(java.lang.String name)
The name used to calculate the key within theExecutionContext
.StaxEventItemReaderBuilder<T>
resource(org.springframework.core.io.Resource resource)
TheResource
to be used as input.StaxEventItemReaderBuilder<T>
saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.StaxEventItemReaderBuilder<T>
strict(boolean strict)
Setting this value to true indicates that it is an error if the input does not exist and an exception will be thrown.StaxEventItemReaderBuilder<T>
unmarshaller(org.springframework.oxm.Unmarshaller unmarshaller)
An implementation of theUnmarshaller
from Spring's OXM module.StaxEventItemReaderBuilder<T>
xmlInputFactory(javax.xml.stream.XMLInputFactory xmlInputFactory)
Set theXMLInputFactory
.
构造器详细资料
StaxEventItemReaderBuilder
public StaxEventItemReaderBuilder()
方法详细资料
saveState
public StaxEventItemReaderBuilder<T> saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- 参数:
saveState
- defaults to true- 返回:
- The current instance of the builder.
name
public StaxEventItemReaderBuilder<T> name(java.lang.String name)
The name used to calculate the key within theExecutionContext
. Required ifsaveState(boolean)
is set to true.- 参数:
name
- name of the reader instance- 返回:
- The current instance of the builder.
- 另请参阅:
ItemStreamSupport.setName(String)
maxItemCount
public StaxEventItemReaderBuilder<T> maxItemCount(int maxItemCount)
Configure the max number of items to be read.- 参数:
maxItemCount
- the max items to be read- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
currentItemCount
public StaxEventItemReaderBuilder<T> currentItemCount(int currentItemCount)
Index for the current item. Used on restarts to indicate where to start from.- 参数:
currentItemCount
- current index- 返回:
- this instance for method chaining
- 另请参阅:
AbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
resource
public StaxEventItemReaderBuilder<T> resource(org.springframework.core.io.Resource resource)
TheResource
to be used as input.- 参数:
resource
- the input to the reader.- 返回:
- The current instance of the builder.
- 另请参阅:
StaxEventItemReader.setResource(Resource)
unmarshaller
public StaxEventItemReaderBuilder<T> unmarshaller(org.springframework.oxm.Unmarshaller unmarshaller)
An implementation of theUnmarshaller
from Spring's OXM module.- 参数:
unmarshaller
- component responsible for unmarshalling XML chunks- 返回:
- The current instance of the builder.
- 另请参阅:
StaxEventItemReader.setUnmarshaller(org.springframework.oxm.Unmarshaller)
addFragmentRootElements
public StaxEventItemReaderBuilder<T> addFragmentRootElements(java.lang.String... fragmentRootElements)
Adds the list of fragments to be used as the root of each chunk to the configuration.- 参数:
fragmentRootElements
- the XML root elements to be used to identify XML chunks.- 返回:
- The current instance of the builder.
- 另请参阅:
StaxEventItemReader.setFragmentRootElementNames(String[])
addFragmentRootElements
public StaxEventItemReaderBuilder<T> addFragmentRootElements(java.util.List<java.lang.String> fragmentRootElements)
Adds the list of fragments to be used as the root of each chunk to the configuration.- 参数:
fragmentRootElements
- the XML root elements to be used to identify XML chunks.- 返回:
- The current instance of the builder.
- 另请参阅:
StaxEventItemReader.setFragmentRootElementNames(String[])
strict
public StaxEventItemReaderBuilder<T> strict(boolean strict)
Setting this value to true indicates that it is an error if the input does not exist and an exception will be thrown. Defaults to true.- 参数:
strict
- indicates the input file must exist- 返回:
- The current instance of the builder
- 另请参阅:
StaxEventItemReader.setStrict(boolean)
xmlInputFactory
public StaxEventItemReaderBuilder<T> xmlInputFactory(javax.xml.stream.XMLInputFactory xmlInputFactory)
Set theXMLInputFactory
.- 参数:
xmlInputFactory
- to use- 返回:
- The current instance of the builder
- 另请参阅:
StaxEventItemReader.setXmlInputFactory(XMLInputFactory)
build
public StaxEventItemReader<T> build()
Validates the configuration and builds a newStaxEventItemReader
- 返回:
- a new instance of the
StaxEventItemReader