additional parameterization of KeyCollector
This commit is contained in:
@@ -118,7 +118,7 @@ public class DrivingQueryItemReader<T> implements ItemReader<T>, InitializingBea
|
||||
*
|
||||
* @return the current key.
|
||||
*/
|
||||
protected Object getCurrentKey() {
|
||||
protected T getCurrentKey() {
|
||||
if (initialized && currentIndex > 0) {
|
||||
return keys.get(currentIndex - 1);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.jdbc.core.RowMapper;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface ItemPreparedStatementSetter {
|
||||
public interface ItemPreparedStatementSetter<T> {
|
||||
/**
|
||||
* Set parameter values on the given PreparedStatement as determined from
|
||||
* the provided item.
|
||||
@@ -34,6 +34,6 @@ public interface ItemPreparedStatementSetter {
|
||||
* @throws SQLException if a SQLException is encountered (i.e. there is no
|
||||
* need to catch SQLException)
|
||||
*/
|
||||
void setValues(Object item, PreparedStatement ps) throws SQLException;
|
||||
void setValues(T item, PreparedStatement ps) throws SQLException;
|
||||
|
||||
}
|
||||
|
||||
@@ -42,5 +42,5 @@ public interface KeyCollector<T> {
|
||||
* @throws IllegalArgumentException if key is null.
|
||||
* @throws IllegalArgumentException if key is an incompatible type.
|
||||
*/
|
||||
void updateContext(Object key, ExecutionContext executionContext);
|
||||
void updateContext(T key, ExecutionContext executionContext);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class ColumnMapItemPreparedStatementSetter implements ItemPreparedStatementSetter {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setValues(Object item, PreparedStatement ps) throws SQLException {
|
||||
Assert.isInstanceOf(Map.class, item, "Input to map PreparedStatement parameters must be of type Map.");
|
||||
Set keySet = ((Map)item).entrySet();
|
||||
|
||||
@@ -61,7 +61,7 @@ public class IbatisKeyCollector<T> extends ExecutionContextUserSupport implement
|
||||
*
|
||||
* @see KeyCollector#saveState(Object, ExecutionContext)
|
||||
*/
|
||||
public void updateContext(Object key, ExecutionContext executionContext) {
|
||||
public void updateContext(T key, ExecutionContext executionContext) {
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
Assert.notNull(executionContext, "ExecutionContext must be null");
|
||||
executionContext.put(getKey(RESTART_KEY), key);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class MultipleColumnJdbcKeyCollector<T> extends ExecutionContextUserSuppo
|
||||
* org.springframework.batch.io.driving.KeyGenerator#getKeyAsExecutionContext
|
||||
* (java.lang.Object)
|
||||
*/
|
||||
public void updateContext(Object key, ExecutionContext executionContext) {
|
||||
public void updateContext(T key, ExecutionContext executionContext) {
|
||||
Assert.notNull(key, "The key must not be null");
|
||||
Assert.notNull(executionContext, "The ExecutionContext must not be null");
|
||||
executionContext.put(getKey(CURRENT_KEY), key);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class SingleColumnJdbcKeyCollector<T> extends ExecutionContextUserSupport
|
||||
*
|
||||
* @throws IllegalArgumentException if key is null.
|
||||
*/
|
||||
public void updateContext(Object key, ExecutionContext executionContext) {
|
||||
public void updateContext(T key, ExecutionContext executionContext) {
|
||||
Assert.notNull(key, "The key must not be null.");
|
||||
Assert.notNull(executionContext, "The ExecutionContext must not be null");
|
||||
executionContext.put(getKey(RESTART_KEY), key);
|
||||
|
||||
Reference in New Issue
Block a user