class ClassifierCompositeItemWriter<T> implements ItemWriter<T> {

	private Classifier<T, ItemWriter<? super T>> classifier = new ClassifierSupport<>(null);

	/**
	 * @param classifier the classifier to set
	 */
	public void setClassifier(Classifier<T, ItemWriter<? super T>> classifier) {
		Assert.notNull(classifier, "A classifier is required.");
		this.classifier = classifier;
	}

	/**
	 * Delegates to injected {@link ItemWriter} instances according to their
	 * classification by the {@link Classifier}.
	 */
	@Override
	public void write(Chunk<? extends T> items) throws Exception {<FILL_FUNCTION_BODY>}

}


		Map<ItemWriter<? super T>, Chunk<T>> map = new LinkedHashMap<>();

		for (T item : items) {
			ItemWriter<? super T> key = classifier.classify(item);
			if (!map.containsKey(key)) {
				map.put(key, new Chunk<>());
			}
			map.get(key).add(item);
		}

		for (ItemWriter<? super T> writer : map.keySet()) {
			writer.write(map.get(writer));
		}

	
<no_super_class>