Class ClassifierCompositeItemWriter<T>
java.lang.Object
org.springframework.batch.item.support.ClassifierCompositeItemWriter<T>
- All Implemented Interfaces:
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, Mahmoud Ben Hassine
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetClassifier(org.springframework.classify.Classifier<T, ItemWriter<? super T>> classifier) voidDelegates to injectedItemWriterinstances according to their classification by theClassifier.
-
Constructor Details
-
ClassifierCompositeItemWriter
public ClassifierCompositeItemWriter()
-
-
Method Details
-
setClassifier
public void setClassifier(org.springframework.classify.Classifier<T, ItemWriter<? super T>> classifier) - Parameters:
classifier- the classifier to set
-
write
Delegates to injectedItemWriterinstances according to their classification by theClassifier.- Specified by:
writein 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.
-