IN PROGRESS - BATCH-709: Change all collections to use generics
This commit is contained in:
@@ -51,7 +51,7 @@ public class JmsItemReader extends AbstractItemReader implements ItemRecoverer,
|
||||
|
||||
private JmsOperations jmsTemplate;
|
||||
|
||||
private Class itemType;
|
||||
private Class<?> itemType;
|
||||
|
||||
private String errorDestinationName;
|
||||
|
||||
@@ -94,7 +94,7 @@ public class JmsItemReader extends AbstractItemReader implements ItemRecoverer,
|
||||
* @throws IllegalStateException if the message payload is of the wrong
|
||||
* type.
|
||||
*/
|
||||
public void setItemType(Class itemType) {
|
||||
public void setItemType(Class<?> itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ public abstract class AbstractBufferedItemReaderItemStream implements ItemReader
|
||||
|
||||
private boolean shouldReadBuffer = false;
|
||||
|
||||
private List itemBuffer = new ArrayList();
|
||||
private List<Object> itemBuffer = new ArrayList<Object>();
|
||||
|
||||
private ListIterator itemBufferIterator = null;
|
||||
private ListIterator<Object> itemBufferIterator = null;
|
||||
|
||||
private int lastMarkedBufferIndex = 0;
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public class AggregateItemReader extends DelegatingItemReader {
|
||||
*
|
||||
*/
|
||||
private static class ResultHolder {
|
||||
Collection records = new ArrayList();
|
||||
Collection<Object> records = new ArrayList<Object>();
|
||||
boolean exhausted = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.springframework.batch.item.support;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
@@ -32,7 +31,7 @@ import org.springframework.batch.item.ItemStreamException;
|
||||
*/
|
||||
public class CompositeItemStream implements ItemStream {
|
||||
|
||||
private List streams = new ArrayList();
|
||||
private List<ItemStream> streams = new ArrayList<ItemStream>();
|
||||
|
||||
/**
|
||||
* Public setter for the listeners.
|
||||
@@ -50,7 +49,6 @@ public class CompositeItemStream implements ItemStream {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple aggregate {@link ExecutionContext} provider for the contributions
|
||||
* registered under the given key.
|
||||
@@ -59,8 +57,7 @@ public class CompositeItemStream implements ItemStream {
|
||||
*/
|
||||
public void update(ExecutionContext executionContext) {
|
||||
synchronized (streams) {
|
||||
for (Iterator it = streams.iterator(); it.hasNext();) {
|
||||
ItemStream itemStream = (ItemStream) it.next();
|
||||
for (ItemStream itemStream : streams) {
|
||||
itemStream.update(executionContext);
|
||||
}
|
||||
}
|
||||
@@ -85,8 +82,7 @@ public class CompositeItemStream implements ItemStream {
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) throws ItemStreamException {
|
||||
synchronized (streams) {
|
||||
for (Iterator it = streams.iterator(); it.hasNext();) {
|
||||
ItemStream itemStream = (ItemStream) it.next();
|
||||
for (ItemStream itemStream : streams) {
|
||||
itemStream.close(executionContext);
|
||||
}
|
||||
}
|
||||
@@ -98,8 +94,7 @@ public class CompositeItemStream implements ItemStream {
|
||||
*/
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
synchronized (streams) {
|
||||
for (Iterator it = streams.iterator(); it.hasNext();) {
|
||||
ItemStream itemStream = (ItemStream) it.next();
|
||||
for (ItemStream itemStream : streams) {
|
||||
itemStream.open(executionContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.springframework.batch.item.support;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.item.ClearFailedException;
|
||||
@@ -16,30 +15,30 @@ import org.springframework.batch.item.ItemWriter;
|
||||
*/
|
||||
public class CompositeItemWriter implements ItemWriter {
|
||||
|
||||
private List delegates;
|
||||
private List<ItemWriter> delegates;
|
||||
|
||||
public void setDelegates(List delegates) {
|
||||
public void setDelegates(List<ItemWriter> delegates) {
|
||||
this.delegates = delegates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls injected ItemProcessors in order.
|
||||
*/
|
||||
public void write(Object data) throws Exception {
|
||||
for (Iterator iterator = delegates.listIterator(); iterator.hasNext();) {
|
||||
((ItemWriter) iterator.next()).write(data);
|
||||
public void write(Object item) throws Exception {
|
||||
for (ItemWriter writer : delegates) {
|
||||
writer.write(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() throws ClearFailedException {
|
||||
for (Iterator iterator = delegates.listIterator(); iterator.hasNext();) {
|
||||
((ItemWriter) iterator.next()).clear();
|
||||
for (ItemWriter writer : delegates) {
|
||||
writer.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void flush() throws FlushFailedException {
|
||||
for (Iterator iterator = delegates.listIterator(); iterator.hasNext();) {
|
||||
((ItemWriter) iterator.next()).flush();
|
||||
for (ItemWriter writer : delegates) {
|
||||
writer.flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,16 +30,16 @@ import org.springframework.batch.item.ItemReader;
|
||||
*/
|
||||
public class ListItemReader extends AbstractItemReader {
|
||||
|
||||
private List list;
|
||||
private List<?> list;
|
||||
|
||||
public ListItemReader(List list) {
|
||||
public ListItemReader(List<?> list) {
|
||||
// If it is a proxy we assume it knows how to deal with its own state.
|
||||
// (It's probably transaction aware.)
|
||||
if (AopUtils.isAopProxy(list)) {
|
||||
this.list = list;
|
||||
}
|
||||
else {
|
||||
this.list = new ArrayList(list);
|
||||
this.list = new ArrayList<Object>(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user