org.springframework.batch.item.adapter

## 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
  See Also:
    `ItemWriterAdapter`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator

      `AbstractMethodInvokingDelegator.InvocationTargetThrowableWrapper`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertyExtractingDelegatingItemWriter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterPropertiesSet()`
    `void` | `setFieldsUsedAsTargetMethodArguments(java.lang.String[] fieldsUsedAsMethodArguments)`
    `void` | `write(java.util.List<? extends T> items)` 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`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PropertyExtractingDelegatingItemWriter

          public PropertyExtractingDelegatingItemWriter()

  - ### Method Detail

    - #### write

          public void write(java.util.List<? extends T> items)
                     throws java.lang.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<T>`
      Parameters:
        `items` - items to be written
      Throws:
        `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

      Specified by:
        `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
      Overrides:
        `afterPropertiesSet` in class `AbstractMethodInvokingDelegator<T>`
      Throws:
        `java.lang.Exception`

    - #### setFieldsUsedAsTargetMethodArguments

          public void setFieldsUsedAsTargetMethodArguments(java.lang.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`