2222import org .springframework .jdbc .core .SqlParameterValue ;
2323
2424/**
25- * Class that provides helper methods for the use of {@link SqlParameterSource}
26- * with {@code SimpleJdbc} classes .
25+ * Class that provides helper methods for the use of {@link SqlParameterSource},
26+ * in particular with {@link NamedParameterJdbcTemplate} .
2727 *
2828 * @author Thomas Risberg
2929 * @since 2.5
3030 */
3131public class SqlParameterSourceUtils {
3232
3333 /**
34- * Create an array of MapSqlParameterSource objects populated with data from the
35- * values passed in. This will define what is included in a batch operation.
36- * @param valueMaps array of Maps containing the values to be used
37- * @return an array of SqlParameterSource
34+ * Create an array of {@link MapSqlParameterSource} objects populated with data from
35+ * the values passed in. This will define what is included in a batch operation.
36+ * @param valueMaps array of {@link Map} instances containing the values to be used
37+ * @return an array of {@link SqlParameterSource}
38+ * @see MapSqlParameterSource
39+ * @see NamedParameterJdbcTemplate#batchUpdate(String, Map[])
3840 */
3941 public static SqlParameterSource [] createBatch (Map <String , ?>[] valueMaps ) {
4042 MapSqlParameterSource [] batch = new MapSqlParameterSource [valueMaps .length ];
4143 for (int i = 0 ; i < valueMaps .length ; i ++) {
42- Map <String , ?> valueMap = valueMaps [i ];
43- batch [i ] = new MapSqlParameterSource (valueMap );
44+ batch [i ] = new MapSqlParameterSource (valueMaps [i ]);
4445 }
4546 return batch ;
4647 }
4748
4849 /**
49- * Create an array of BeanPropertySqlParameterSource objects populated with data
50+ * Create an array of {@link BeanPropertySqlParameterSource} objects populated with data
5051 * from the values passed in. This will define what is included in a batch operation.
5152 * @param beans object array of beans containing the values to be used
52- * @return an array of SqlParameterSource
53+ * @return an array of {@link SqlParameterSource}
54+ * @see BeanPropertySqlParameterSource
55+ * @see NamedParameterJdbcTemplate#batchUpdate(String, SqlParameterSource[])
5356 */
5457 public static SqlParameterSource [] createBatch (Object [] beans ) {
5558 BeanPropertySqlParameterSource [] batch = new BeanPropertySqlParameterSource [beans .length ];
5659 for (int i = 0 ; i < beans .length ; i ++) {
57- Object bean = beans [i ];
58- batch [i ] = new BeanPropertySqlParameterSource (bean );
60+ batch [i ] = new BeanPropertySqlParameterSource (beans [i ]);
5961 }
6062 return batch ;
6163 }
6264
6365 /**
6466 * Create a wrapped value if parameter has type information, plain object if not.
65- * @param source the source of paramer values and type information
67+ * @param source the source of parameter values and type information
6668 * @param parameterName the name of the parameter
6769 * @return the value object
6870 */
@@ -83,13 +85,13 @@ public static Object getTypedValue(SqlParameterSource source, String parameterNa
8385
8486 /**
8587 * Create a Map of case insensitive parameter names together with the original name.
86- * @param parameterSource the source of paramer names
88+ * @param parameterSource the source of parameter names
8789 * @return the Map that can be used for case insensitive matching of parameter names
8890 */
8991 public static Map <String , String > extractCaseInsensitiveParameterNames (SqlParameterSource parameterSource ) {
9092 Map <String , String > caseInsensitiveParameterNames = new HashMap <String , String >();
9193 if (parameterSource instanceof BeanPropertySqlParameterSource ) {
92- String [] propertyNames = ((BeanPropertySqlParameterSource )parameterSource ).getReadablePropertyNames ();
94+ String [] propertyNames = ((BeanPropertySqlParameterSource ) parameterSource ).getReadablePropertyNames ();
9395 for (String name : propertyNames ) {
9496 caseInsensitiveParameterNames .put (name .toLowerCase (), name );
9597 }
0 commit comments