org.springframework.batch.item.adapter
Class PropertyExtractingDelegatingItemWriter
java.lang.Object
org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator
org.springframework.batch.item.adapter.PropertyExtractingDelegatingItemWriter
- All Implemented Interfaces:
- ItemWriter, InitializingBean
public class PropertyExtractingDelegatingItemWriter
- extends AbstractMethodInvokingDelegator
- implements ItemWriter
Delegates processing to a custom method - extracts property values
from item object and uses them as arguments for the delegate method.
- Author:
- Robert Kasanicky
- See Also:
ItemWriterAdapter
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PropertyExtractingDelegatingItemWriter
public PropertyExtractingDelegatingItemWriter()
write
public void write(Object item)
throws Exception
- Extracts values from item's fields named in fieldsUsedAsTargetMethodArguments
and passes them as arguments to the delegate method.
- Specified by:
write
in interface ItemWriter
- Throws:
Exception
- if there are errors. If the writer is used inside a
retry or a batch the framework will catch the exception and convert or
rethrow it as appropriate.
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- Specified by:
afterPropertiesSet
in interface InitializingBean
- Overrides:
afterPropertiesSet
in class AbstractMethodInvokingDelegator
- Throws:
Exception
setFieldsUsedAsTargetMethodArguments
public void setFieldsUsedAsTargetMethodArguments(String[] fieldsUsedAsMethodArguments)
- Parameters:
fieldsUsedAsMethodArguments
- the values of the these item's fields
will be used as arguments for the delegate method. Nested property values are
supported, e.g. address.city
clear
public void clear()
throws ClearFailedException
- Description copied from interface:
ItemWriter
- Clear any buffers that are being held. This will usually be performed
prior to rolling back any transactions.
- Specified by:
clear
in interface ItemWriter
- Throws:
ClearFailedException
- in case of an error. If this exception is
thrown the writer may be in an inconsistent state and manual intervention
might be required to reconcile the data with persistent output.
flush
public void flush()
throws FlushFailedException
- Description copied from interface:
ItemWriter
- Flush any buffers that are being held. This will usually be performed
prior to committing any transactions.
- Specified by:
flush
in interface ItemWriter
- Throws:
FlushFailedException
- in case of an error. If this exception is
thrown the writer may be in an inconsistent state and manual intervention
might be required to reconcile the data with persistent output.
Copyright © 2009 SpringSource. All Rights Reserved.