类 KeyValueItemWriter<K,V>
- java.lang.Object
- org.springframework.batch.item.KeyValueItemWriter<K,V>
- 所有已实现的接口:
ItemWriter<V>,org.springframework.beans.factory.InitializingBean
- 直接已知子类:
GemfireItemWriter
public abstract class KeyValueItemWriter<K,V> extends java.lang.Object implements ItemWriter<V>, org.springframework.beans.factory.InitializingBean
A base class to implement anyItemWriterthat writes to a key value store using aConverterto derive a key from an item- 从以下版本开始:
- 2.2
- 作者:
- David Turanski
字段概要
字段 修饰符和类型 字段 说明 protected booleandeleteprotected org.springframework.core.convert.converter.Converter<V,K>itemKeyMapper
构造器概要
构造器 构造器 说明 KeyValueItemWriter()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 voidafterPropertiesSet()protected abstract voidinit()afterPropertiesSet() hookvoidsetDelete(boolean delete)Sets the delete flag to have the item writer perform deletesvoidsetItemKeyMapper(org.springframework.core.convert.converter.Converter<V,K> itemKeyMapper)Set theConverterto use to derive the key from the itemvoidwrite(java.util.List<? extends V> items)Process the supplied data element.protected abstract voidwriteKeyValue(K key, V value)Subclasses implement this method to write each item to key value store
字段详细资料
itemKeyMapper
protected org.springframework.core.convert.converter.Converter<V,K> itemKeyMapper
delete
protected boolean delete
构造器详细资料
KeyValueItemWriter
public KeyValueItemWriter()
方法详细资料
write
public void write(java.util.List<? extends V> items) throws java.lang.Exception
从接口复制的说明:ItemWriterProcess the supplied data element. Will not be called with any null items in normal operation.- 指定者:
write在接口中ItemWriter<K>- 参数:
items- items to be written- 抛出:
java.lang.Exception- if there are errors. The framework will catch the exception and convert or rethrow it as appropriate.
writeKeyValue
protected abstract void writeKeyValue(K key, V value)
Subclasses implement this method to write each item to key value store- 参数:
key- the keyvalue- the item
init
protected abstract void init()
afterPropertiesSet() hook
setItemKeyMapper
public void setItemKeyMapper(org.springframework.core.convert.converter.Converter<V,K> itemKeyMapper)
Set theConverterto use to derive the key from the item- 参数:
itemKeyMapper- theConverterused to derive a key from an item.
setDelete
public void setDelete(boolean delete)
Sets the delete flag to have the item writer perform deletes- 参数:
delete- if trueItemWriterwill perform deletes, if false not to perform deletes.
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- 指定者:
afterPropertiesSet在接口中org.springframework.beans.factory.InitializingBean- 抛出:
java.lang.Exception