OPEN - issue BATCH-404: FactoryBeans for step configuration
http://jira.springframework.org/browse/BATCH-404 Let the factory bean take care of chunk and item listener callbacks. ItemOrientedStep is much simpler as a result.
This commit is contained in:
@@ -31,6 +31,21 @@ import org.springframework.util.Assert;
|
||||
public class DelegatingItemReader extends AbstractItemReader implements Skippable, InitializingBean {
|
||||
|
||||
private ItemReader itemReader;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public DelegatingItemReader() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience constructor for setting mandatory property.
|
||||
*/
|
||||
public DelegatingItemReader(ItemReader itemReader) {
|
||||
this();
|
||||
this.itemReader = itemReader;
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(itemReader, "ItemReader must not be null.");
|
||||
|
||||
@@ -16,6 +16,21 @@ public class DelegatingItemWriter implements ItemWriter, InitializingBean {
|
||||
|
||||
private ItemWriter writer;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public DelegatingItemWriter() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemWriter
|
||||
*/
|
||||
public DelegatingItemWriter(ItemWriter itemWriter) {
|
||||
this();
|
||||
this.writer = itemWriter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link #doProcess(Object)} and then writes the result to the
|
||||
* delegate {@link ItemWriter}.
|
||||
@@ -23,7 +38,7 @@ public class DelegatingItemWriter implements ItemWriter, InitializingBean {
|
||||
*
|
||||
* @see ItemWriter#process(java.lang.Object)
|
||||
*/
|
||||
final public void write(Object item) throws Exception {
|
||||
public void write(Object item) throws Exception {
|
||||
Object result = doProcess(item);
|
||||
writer.write(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user