Class MultiResourceItemWriterBuilder<T>
java.lang.Object
org.springframework.batch.item.file.builder.MultiResourceItemWriterBuilder<T>
A builder implementation for the
MultiResourceItemWriter
.- Since:
- 4.0
- Author:
- Glenn Renfro, Glenn Renfro
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds theMultiResourceItemWriter
.delegate
(ResourceAwareItemWriterItemStream<? super T> delegate) Delegate used for actual writing of the output.itemCountLimitPerResource
(int itemCountLimitPerResource) After this limit is exceeded the next chunk will be written into newly created resource.The name used to calculate the key within theExecutionContext
.resource
(org.springframework.core.io.Resource resource) Prototype for output resources.resourceSuffixCreator
(ResourceSuffixCreator suffixCreator) Allows customization of the suffix of the created resources based on the index.saveState
(boolean saveState) Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.
-
Constructor Details
-
MultiResourceItemWriterBuilder
public MultiResourceItemWriterBuilder()
-
-
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:
-
resourceSuffixCreator
Allows customization of the suffix of the created resources based on the index.- Parameters:
suffixCreator
- the customizable ResourceSuffixCreator to use.- Returns:
- The current instance of the builder.
- See Also:
-
itemCountLimitPerResource
After this limit is exceeded the next chunk will be written into newly created resource.- Parameters:
itemCountLimitPerResource
- the max numbers of items to be written per chunk.- Returns:
- The current instance of the builder.
- See Also:
-
delegate
public MultiResourceItemWriterBuilder<T> delegate(ResourceAwareItemWriterItemStream<? super T> delegate) Delegate used for actual writing of the output.- Parameters:
delegate
- The delegate to use for writing.- Returns:
- The current instance of the builder.
- See Also:
-
resource
Prototype for output resources. Actual output files will be created in the same directory and use the same name as this prototype with appended suffix (according toMultiResourceItemWriter.setResourceSuffixCreator(ResourceSuffixCreator)
.- Parameters:
resource
- the prototype resource to use as the basis for creating resources.- Returns:
- The current instance of the builder.
- See Also:
-
build
Builds theMultiResourceItemWriter
.- Returns:
- a
MultiResourceItemWriter
-