Preparations for eventual removal of ParameterizedRowMapper along with SimpleJdbcTemplate

Issue: SPR-11895
This commit is contained in:
Juergen Hoeller
2014-06-24 19:26:53 +02:00
parent 13c4a0396d
commit a6f3f101e4
5 changed files with 30 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -63,7 +63,7 @@ import org.springframework.util.StringUtils;
* will have been set to the primitive's default value instead of null.
*
* <p>Please note that this class is designed to provide convenience rather than high performance.
* For best performance consider using a custom RowMapper.
* For best performance, consider using a custom {@link RowMapper} implementation.
*
* @author Thomas Risberg
* @author Juergen Hoeller

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@@ -185,4 +185,17 @@ public class SingleColumnRowMapper<T> implements RowMapper<T> {
}
}
/**
* Static factory method to create a new ParameterizedSingleColumnRowMapper
* (with the required type specified only once).
* @param requiredType the type that each result object is expected to match
* @since 4.1
*/
public static <T> SingleColumnRowMapper<T> newInstance(Class<T> requiredType) {
SingleColumnRowMapper<T> newInstance = new SingleColumnRowMapper<T>();
newInstance.setRequiredType(requiredType);
return newInstance;
}
}

View File

@@ -43,13 +43,17 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
* try using column aliases in the SQL statement like "select fname as first_name from customer".
*
* <p>Please note that this class is designed to provide convenience rather than high performance.
* For best performance consider using a custom RowMapper.
* For best performance, consider using a custom {@link org.springframework.jdbc.core.RowMapper}
* implementation.
*
* @author Thomas Risberg
* @author Juergen Hoeller
* @since 2.5
* @see ParameterizedRowMapper
* @deprecated along with {@link SimpleJdbcTemplate}, in favor of the regular
* {@link org.springframework.jdbc.core.BeanPropertyRowMapper}
*/
@Deprecated
public class ParameterizedBeanPropertyRowMapper<T> extends BeanPropertyRowMapper<T>
implements ParameterizedRowMapper<T> {

View File

@@ -27,7 +27,10 @@ import org.springframework.jdbc.core.RowMapper;
* @author Juergen Hoeller
* @since 2.0
* @see org.springframework.jdbc.core.simple.SimpleJdbcOperations
* @deprecated along with {@link SimpleJdbcTemplate}, in favor of the regular
* {@link org.springframework.jdbc.core.SingleColumnRowMapper}
*/
@Deprecated
public interface ParameterizedRowMapper<T> extends RowMapper<T> {
}

View File

@@ -32,7 +32,10 @@ import org.springframework.jdbc.core.SingleColumnRowMapper;
*
* @author Juergen Hoeller
* @since 2.5.2
* @deprecated along with {@link SimpleJdbcTemplate}, in favor of the regular
* {@link org.springframework.jdbc.core.SingleColumnRowMapper}
*/
@Deprecated
public class ParameterizedSingleColumnRowMapper<T> extends SingleColumnRowMapper<T>
implements ParameterizedRowMapper<T> {
@@ -42,9 +45,9 @@ public class ParameterizedSingleColumnRowMapper<T> extends SingleColumnRowMapper
* @param requiredType the type that each result object is expected to match
*/
public static <T> ParameterizedSingleColumnRowMapper<T> newInstance(Class<T> requiredType) {
ParameterizedSingleColumnRowMapper<T> rm = new ParameterizedSingleColumnRowMapper<T>();
rm.setRequiredType(requiredType);
return rm;
ParameterizedSingleColumnRowMapper<T> newInstance = new ParameterizedSingleColumnRowMapper<T>();
newInstance.setRequiredType(requiredType);
return newInstance;
}
}