Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright 2006-2007 the original author or authors.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
Composite org.springframework.batch.item.ItemProcessor that passes the item through a sequence of injected ItemTransformers (return value of previous transformation is the entry value of the next).

Note the user is responsible for injecting a chain of org.springframework.batch.item.ItemProcessor s that conforms to declared input and output types.

Robert Kasanicky
public class CompositeItemProcessor<I, O> implements ItemProcessor<I, O>, InitializingBean {
	public O process(I itemthrows Exception {
		Object result = item;
		for (ItemProcessor<ObjectObjectdelegate : ) {
			if (result == null) {
				return null;
			result = delegate.process(result);
		return (O) result;
	public void afterPropertiesSet() throws Exception {
		Assert.notNull("The 'delgates' may not be null");
		Assert.notEmpty("The 'delgates' may not be empty");
	public void setDelegates(List<ItemProcessor<ObjectObject>> delegates) {
		this. = delegates;
New to GrepCode? Check out our FAQ X