Class MultiResourceItemReaderBuilder<T>
java.lang.Object
org.springframework.batch.item.file.builder.MultiResourceItemReaderBuilder<T>
A builder implementation for the
MultiResourceItemReader
.- Since:
- 4.0
- Author:
- Glenn Renfro, Drummond Dawson
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds theMultiResourceItemReader
.comparator
(Comparator<org.springframework.core.io.Resource> comparator) Used to order the injected resources, by default comparesResource.getFilename()
values.delegate
(ResourceAwareItemReaderItemStream<? extends T> delegate) Establishes the delegate to use for reading the resources provided.The name used to calculate the key within theExecutionContext
.resources
(org.springframework.core.io.Resource... resources) The array of resources that theMultiResourceItemReader
will use to retrieve items.saveState
(boolean saveState) Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.setStrict
(boolean strict) In strict mode the reader will throw an exception onMultiResourceItemReader.open(org.springframework.batch.item.ExecutionContext)
if there are no resources to read.
-
Constructor Details
-
MultiResourceItemReaderBuilder
public MultiResourceItemReaderBuilder()
-
-
Method Details
-
saveState
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- Parameters:
saveState
- defaults to true- Returns:
- The current instance of the builder.
-
name
The name used to calculate the key within theExecutionContext
. Required ifsaveState(boolean)
is set to true.- Parameters:
name
- name of the reader instance- Returns:
- The current instance of the builder.
- See Also:
-
resources
public MultiResourceItemReaderBuilder<T> resources(org.springframework.core.io.Resource... resources) The array of resources that theMultiResourceItemReader
will use to retrieve items.- Parameters:
resources
- the array of resources to use.- Returns:
- this instance for method chaining.
- See Also:
-
delegate
public MultiResourceItemReaderBuilder<T> delegate(ResourceAwareItemReaderItemStream<? extends T> delegate) Establishes the delegate to use for reading the resources provided.- Parameters:
delegate
- reads items from singleResource
.- Returns:
- this instance for method chaining.
- See Also:
-
setStrict
In strict mode the reader will throw an exception onMultiResourceItemReader.open(org.springframework.batch.item.ExecutionContext)
if there are no resources to read.- Parameters:
strict
- false by default.- Returns:
- this instance for method chaining.
- See Also:
-
comparator
public MultiResourceItemReaderBuilder<T> comparator(Comparator<org.springframework.core.io.Resource> comparator) Used to order the injected resources, by default comparesResource.getFilename()
values.- Parameters:
comparator
- the comparator to use for ordering resources.- Returns:
- this instance for method chaining.
- See Also:
-
build
Builds theMultiResourceItemReader
.- Returns:
- a
MultiResourceItemReader
-