Class PropertyExtractingDelegatingItemWriter<T>
java.lang.Object
org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator<T>
org.springframework.batch.item.adapter.PropertyExtractingDelegatingItemWriter<T>
- All Implemented Interfaces:
ItemWriter<T>
,org.springframework.beans.factory.InitializingBean
public class PropertyExtractingDelegatingItemWriter<T>
extends AbstractMethodInvokingDelegator<T>
implements ItemWriter<T>
Delegates processing to a custom method - extracts property values from item object and
uses them as arguments for the delegate method.
- Author:
- Robert Kasanicky, Mahmoud Ben Hassine
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator
AbstractMethodInvokingDelegator.InvocationTargetThrowableWrapper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
setFieldsUsedAsTargetMethodArguments
(String[] fieldsUsedAsMethodArguments) void
Extracts values from item's fields named in fieldsUsedAsTargetMethodArguments and passes them as arguments to the delegate method.Methods inherited from class org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator
getArguments, invokeDelegateMethod, invokeDelegateMethodWithArgument, invokeDelegateMethodWithArguments, setArguments, setTargetMethod, setTargetObject
-
Constructor Details
-
PropertyExtractingDelegatingItemWriter
public PropertyExtractingDelegatingItemWriter()
-
-
Method Details
-
write
Extracts values from item's fields named in fieldsUsedAsTargetMethodArguments and passes them as arguments to the delegate method.- Specified by:
write
in interfaceItemWriter<T>
- Parameters:
items
- of items to be written. Must not benull
.- Throws:
Exception
- if there are errors. The framework will catch the exception and convert or rethrow it as appropriate.
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Overrides:
afterPropertiesSet
in classAbstractMethodInvokingDelegator<T>
- Throws:
Exception
-
setFieldsUsedAsTargetMethodArguments
- 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
-