org.springframework.batch.item.support

## Class ClassifierCompositeItemProcessor<I,O>

- java.lang.Object
- - org.springframework.batch.item.support.ClassifierCompositeItemProcessor<I,O>

- All Implemented Interfaces:
    ItemProcessor<I,O>

      public class ClassifierCompositeItemProcessor<I,O>
      extends java.lang.Object
      implements ItemProcessor<I,O>

  Calls one of a collection of ItemProcessors, based on a router pattern implemented through the provided `Classifier`. Note the user is responsible for injecting a `Classifier` that returns an ItemProcessor that conforms to the declared input and output types.
  Since:
    3.0
  Author:
    Jimmy Praet

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClassifierCompositeItemProcessor()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `O` | `process(I item)` Delegates to injected `ItemProcessor` instances according to the classification by the `Classifier`.
    `void` | `setClassifier(org.springframework.classify.Classifier<? super I,ItemProcessor<?,? extends O>> classifier)` Establishes the classifier that will determine which `ItemProcessor` to use.

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

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

- - ### Constructor Detail

    - #### ClassifierCompositeItemProcessor

          public ClassifierCompositeItemProcessor()

  - ### Method Detail

    - #### setClassifier

          public void setClassifier(org.springframework.classify.Classifier<? super I,ItemProcessor<?,? extends O>> classifier)

      Establishes the classifier that will determine which `ItemProcessor` to use.
      Parameters:
        `classifier` - the `Classifier` to set

    - #### process

          @Nullable
          public O process(I item)
                              throws java.lang.Exception

      Delegates to injected `ItemProcessor` instances according to the classification by the `Classifier`.
      Specified by:
        `process` in interface `ItemProcessor<I,O>`
      Parameters:
        `item` - to be processed
      Returns:
        potentially modified or new item for continued processing, `null` if processing of the provided item should not continue.
      Throws:
        `java.lang.Exception` - thrown if exception occurs during processing.