org.springframework.batch.item.support

## Class ClassifierCompositeItemWriter<T>

- java.lang.Object
- - org.springframework.batch.item.support.ClassifierCompositeItemWriter<T>

- All Implemented Interfaces:
    ItemWriter<T>

      public class ClassifierCompositeItemWriter<T>
      extends java.lang.Object
      implements ItemWriter<T>

  Calls one of a collection of ItemWriters for each item, based on a router pattern implemented through the provided `Classifier`. The implementation is thread-safe if all delegates are thread-safe.
  Since:
    2.0
  Author:
    Dave Syer, Glenn Renfro

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClassifierCompositeItemWriter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `setClassifier(org.springframework.classify.Classifier<T,ItemWriter<? super T>> classifier)`
    `void` | `write(java.util.List<? extends T> items)` Delegates to injected `ItemWriter` instances according to their classification by the `Classifier`.

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

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

- - ### Constructor Detail

    - #### ClassifierCompositeItemWriter

          public ClassifierCompositeItemWriter()

  - ### Method Detail

    - #### setClassifier

          public void setClassifier(org.springframework.classify.Classifier<T,ItemWriter<? super T>> classifier)

      Parameters:
        `classifier` - the classifier to set

    - #### write

          public void write(java.util.List<? extends T> items)
                     throws java.lang.Exception

      Delegates to injected `ItemWriter` instances according to their classification by the `Classifier`.
      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.