Package org.springframework.jdbc.core.namedparam

# Class SqlParameterSourceUtils

java.lang.Object
org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils

public abstract class SqlParameterSourceUtils extends Object
Class that provides helper methods for the use of `SqlParameterSource`, in particular with `NamedParameterJdbcTemplate`.

Since:
  2.5
Author:
  Thomas Risberg, Juergen Hoeller

## Constructor Summary

Constructors
Constructor
Description
`SqlParameterSourceUtils()`

## Method Summary

Modifier and Type
Method
Description
`static SqlParameterSource[]`
`createBatch(Object... candidates)`
Create an array of `SqlParameterSource` objects populated with data from the values passed in (either a `Map` or a bean object).
`static SqlParameterSource[]`
`createBatch(Collection<?> candidates)`
Create an array of `SqlParameterSource` objects populated with data from the values passed in (either a `Map` or a bean object).
`static SqlParameterSource[]`
`createBatch(Map<String,?>[] valueMaps)`
Create an array of `MapSqlParameterSource` objects populated with data from the values passed in.
`static Map<String,String>`
`extractCaseInsensitiveParameterNames(SqlParameterSource parameterSource)`
Create a Map of case-insensitive parameter names together with the original name.
`static Object`
`getTypedValue(SqlParameterSource source, String parameterName)`
Create a wrapped value if parameter has type information, plain object if not.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SqlParameterSourceUtils

public SqlParameterSourceUtils()

## Method Details

### createBatch

public static SqlParameterSource[] createBatch(Object... candidates)
Create an array of `SqlParameterSource` objects populated with data from the values passed in (either a `Map` or a bean object). This will define what is included in a batch operation.

Parameters:
  `candidates` - object array of objects containing the values to be used
Returns:
  an array of `SqlParameterSource`
See Also:
  - `MapSqlParameterSource`
  - `BeanPropertySqlParameterSource`
  - `NamedParameterJdbcTemplate.batchUpdate(String, SqlParameterSource[])`

### createBatch

public static SqlParameterSource[] createBatch(Collection<?> candidates)
Create an array of `SqlParameterSource` objects populated with data from the values passed in (either a `Map` or a bean object). This will define what is included in a batch operation.

Parameters:
  `candidates` - collection of objects containing the values to be used
Returns:
  an array of `SqlParameterSource`
Since:
  5.0.2
See Also:
  - `MapSqlParameterSource`
  - `BeanPropertySqlParameterSource`
  - `NamedParameterJdbcTemplate.batchUpdate(String, SqlParameterSource[])`

### createBatch

public static SqlParameterSource[] createBatch(Map<String,?>[] valueMaps)
Create an array of `MapSqlParameterSource` objects populated with data from the values passed in. This will define what is included in a batch operation.

Parameters:
  `valueMaps` - array of `Map` instances containing the values to be used
Returns:
  an array of `SqlParameterSource`
See Also:
  - `MapSqlParameterSource`
  - `NamedParameterJdbcTemplate.batchUpdate(String, Map[])`

### getTypedValue

@Nullable public static Object getTypedValue(SqlParameterSource source, String parameterName)
Create a wrapped value if parameter has type information, plain object if not.

Parameters:
  `source` - the source of parameter values and type information
  `parameterName` - the name of the parameter
Returns:
  the value object
See Also:
  - `SqlParameterValue`

### extractCaseInsensitiveParameterNames

public static Map<String,String> extractCaseInsensitiveParameterNames(SqlParameterSource parameterSource)
Create a Map of case-insensitive parameter names together with the original name.

Parameters:
  `parameterSource` - the source of parameter names
Returns:
  the Map that can be used for case-insensitive matching of parameter names