public abstract class KeyValueItemWriter<K,V> extends java.lang.Object implements ItemWriter<V>, org.springframework.beans.factory.InitializingBean
ItemWriter
that writes to a key value store
using a Converter
to derive a key from an itemModifier and Type | Field and Description |
---|---|
protected boolean |
delete |
protected org.springframework.core.convert.converter.Converter<V,K> |
itemKeyMapper |
Constructor and Description |
---|
KeyValueItemWriter() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected void |
flush()
Flush items to the key/value store.
|
protected abstract void |
init()
afterPropertiesSet() hook
|
void |
setDelete(boolean delete)
Sets the delete flag to have the item writer perform deletes
|
void |
setItemKeyMapper(org.springframework.core.convert.converter.Converter<V,K> itemKeyMapper)
Set the
Converter to use to derive the key from the item |
void |
write(java.util.List<? extends V> items)
Process the supplied data element.
|
protected abstract void |
writeKeyValue(K key,
V value)
Subclasses implement this method to write each item to key value store
|
public void write(java.util.List<? extends V> items) throws java.lang.Exception
ItemWriter
write
in interface ItemWriter<V>
items
- items to be writtenjava.lang.Exception
- if there are errors. The framework will catch the
exception and convert or rethrow it as appropriate.protected void flush() throws java.lang.Exception
java.lang.Exception
- if unable to flush itemsprotected abstract void writeKeyValue(K key, V value)
key
- the keyvalue
- the itemprotected abstract void init()
public void setItemKeyMapper(org.springframework.core.convert.converter.Converter<V,K> itemKeyMapper)
Converter
to use to derive the key from the itemitemKeyMapper
- the Converter
used to derive a key from an item.public void setDelete(boolean delete)
delete
- if true ItemWriter
will perform deletes,
if false not to perform deletes.public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception