类 CompositeItemWriter<T>
- java.lang.Object
- org.springframework.batch.item.support.CompositeItemWriter<T>
- 所有已实现的接口:
ItemStream
,ItemStreamWriter<T>
,ItemWriter<T>
,org.springframework.beans.factory.InitializingBean
public class CompositeItemWriter<T> extends java.lang.Object implements ItemStreamWriter<T>, org.springframework.beans.factory.InitializingBean
Calls a collection ofItemWriter
s in fixed-order sequence.
The implementation is thread-safe if all delegates are thread-safe.- 作者:
- Robert Kasanicky, Dave Syer
构造器概要
构造器 构造器 说明 CompositeItemWriter()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
void
close()
If any resources are needed for the stream to operate they need to be destroyed here.void
open(ExecutionContext executionContext)
Open the stream for the providedExecutionContext
.void
setDelegates(java.util.List<ItemWriter<? super T>> delegates)
The list of item writers to use as delegates.void
setIgnoreItemStream(boolean ignoreItemStream)
Establishes the policy whether to call the open, close, or update methods for the item writer delegates associated with the CompositeItemWriter.void
update(ExecutionContext executionContext)
Indicates that the execution context provided during open is about to be saved.void
write(java.util.List<? extends T> item)
Process the supplied data element.
构造器详细资料
CompositeItemWriter
public CompositeItemWriter()
方法详细资料
setIgnoreItemStream
public void setIgnoreItemStream(boolean ignoreItemStream)
Establishes the policy whether to call the open, close, or update methods for the item writer delegates associated with the CompositeItemWriter.- 参数:
ignoreItemStream
- if false the delegates' open, close, or update methods will be called when the corresponding methods on the CompositeItemWriter are called. If true the delegates' open, close, nor update methods will not be called (default is false).
write
public void write(java.util.List<? extends T> item) throws java.lang.Exception
从接口复制的说明:ItemWriter
Process the supplied data element. Will not be called with any null items in normal operation.- 指定者:
write
在接口中ItemWriter<T>
- 参数:
item
- items to be written- 抛出:
java.lang.Exception
- if there are errors. The framework will catch the exception and convert or rethrow it as appropriate.
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception
setDelegates
public void setDelegates(java.util.List<ItemWriter<? super T>> delegates)
The list of item writers to use as delegates. Items are written to each of the delegates.- 参数:
delegates
- the list of delegates to use. The delegates list must not be null nor be empty.
close
public void close() throws ItemStreamException
从接口复制的说明:ItemStream
If any resources are needed for the stream to operate they need to be destroyed here. Once this method has been called all other methods (except open) may throw an exception.- 指定者:
close
在接口中ItemStream
- 抛出:
ItemStreamException
open
public void open(ExecutionContext executionContext) throws ItemStreamException
从接口复制的说明:ItemStream
Open the stream for the providedExecutionContext
.- 指定者:
open
在接口中ItemStream
- 参数:
executionContext
- current step'sExecutionContext
. Will be the executionContext from the last run of the step on a restart.- 抛出:
ItemStreamException
update
public void update(ExecutionContext executionContext) throws ItemStreamException
从接口复制的说明:ItemStream
Indicates that the execution context provided during open is about to be saved. If any state is remaining, but has not been put in the context, it should be added here.- 指定者:
update
在接口中ItemStream
- 参数:
executionContext
- to be updated- 抛出:
ItemStreamException