类 MultiResourceItemWriterBuilder<T>
- java.lang.Object
- org.springframework.batch.item.file.builder.MultiResourceItemWriterBuilder<T>
public class MultiResourceItemWriterBuilder<T> extends java.lang.Object
A builder implementation for theMultiResourceItemWriter.- 从以下版本开始:
- 4.0
- 作者:
- Glenn Renfro, Glenn Renfro
- 另请参阅:
MultiResourceItemWriter
构造器概要
构造器 构造器 说明 MultiResourceItemWriterBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 MultiResourceItemWriter<T>build()Builds theMultiResourceItemWriter.MultiResourceItemWriterBuilder<T>delegate(ResourceAwareItemWriterItemStream<? super T> delegate)Delegate used for actual writing of the output.MultiResourceItemWriterBuilder<T>itemCountLimitPerResource(int itemCountLimitPerResource)After this limit is exceeded the next chunk will be written into newly created resource.MultiResourceItemWriterBuilder<T>name(java.lang.String name)The name used to calculate the key within theExecutionContext.MultiResourceItemWriterBuilder<T>resource(org.springframework.core.io.Resource resource)Prototype for output resources.MultiResourceItemWriterBuilder<T>resourceSuffixCreator(ResourceSuffixCreator suffixCreator)Allows customization of the suffix of the created resources based on the index.MultiResourceItemWriterBuilder<T>saveState(boolean saveState)Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.
构造器详细资料
MultiResourceItemWriterBuilder
public MultiResourceItemWriterBuilder()
方法详细资料
saveState
public MultiResourceItemWriterBuilder<T> saveState(boolean saveState)
Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.- 参数:
saveState- defaults to true- 返回:
- The current instance of the builder.
name
public MultiResourceItemWriterBuilder<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)
resourceSuffixCreator
public MultiResourceItemWriterBuilder<T> resourceSuffixCreator(ResourceSuffixCreator suffixCreator)
Allows customization of the suffix of the created resources based on the index.- 参数:
suffixCreator- the customizable ResourceSuffixCreator to use.- 返回:
- The current instance of the builder.
- 另请参阅:
MultiResourceItemWriter.setResourceSuffixCreator(ResourceSuffixCreator)
itemCountLimitPerResource
public MultiResourceItemWriterBuilder<T> itemCountLimitPerResource(int itemCountLimitPerResource)
After this limit is exceeded the next chunk will be written into newly created resource.- 参数:
itemCountLimitPerResource- the max numbers of items to be written per chunk.- 返回:
- The current instance of the builder.
- 另请参阅:
MultiResourceItemWriter.setItemCountLimitPerResource(int)
delegate
public MultiResourceItemWriterBuilder<T> delegate(ResourceAwareItemWriterItemStream<? super T> delegate)
Delegate used for actual writing of the output.- 参数:
delegate- The delegate to use for writing.- 返回:
- The current instance of the builder.
- 另请参阅:
MultiResourceItemWriter.setDelegate(ResourceAwareItemWriterItemStream)
resource
public MultiResourceItemWriterBuilder<T> resource(org.springframework.core.io.Resource 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).- 参数:
resource- the prototype resource to use as the basis for creating resources.- 返回:
- The current instance of the builder.
- 另请参阅:
MultiResourceItemWriter.setResource(Resource)
build
public MultiResourceItemWriter<T> build()
Builds theMultiResourceItemWriter.