Top Description Constructors Methods
org.springframework.jdbc.core.namedparam

public abstract Class SqlParameterSourceUtils

extends Object
Class Inheritance
Imports
java.util.Arrays, .Collection, .HashMap, .Map, org.springframework.jdbc.core.SqlParameterValue, org.springframework.lang.Nullable

Class that provides helper methods for the use of SqlParameterSource, in particular with NamedParameterJdbcTemplate.
Authors
Thomas Risberg, Juergen Hoeller
Since
2.5

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static SqlParameterSource[]

Returns:

an array of SqlParameterSource
createBatch
(Object...
object array of objects containing the values to be used
candidates
)

Create an array of SqlParameterSource objects populated with data from the values passed in (either a Map or a bean object).

public static SqlParameterSource[]

Returns:

an array of SqlParameterSource
createBatch
(Collection<?>
collection of objects containing the values to be used
candidates
)

Create an array of SqlParameterSource objects populated with data from the values passed in (either a Map or a bean object).

public static SqlParameterSource[]

Returns:

an array of SqlParameterSource
createBatch
(Map<String, ?>[]
array of Map instances containing the values to be used
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.

public static Map<String, String>

Returns:

the Map that can be used for case-insensitive matching of parameter names
extractCaseInsensitiveParameterNames
(SqlParameterSource
the source of parameter names
parameterSource
)

Create a Map of case-insensitive parameter names together with the original name.

public static Object

Returns:

the value object
getTypedValue
(SqlParameterSource
the source of parameter values and type information
source
,
String
the name of the parameter
parameterName
)

Create a wrapped value if parameter has type information, plain object if not.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SqlParameterSourceUtilsback to summary
public SqlParameterSourceUtils()

Method Detail

createBatchback to summary
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[]

object array of objects containing the values to be used

Returns:SqlParameterSource[]

an array of SqlParameterSource

See Also
MapSqlParameterSource, BeanPropertySqlParameterSource, NamedParameterJdbcTemplate#batchUpdate(String, SqlParameterSource[])
createBatchback to summary
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<?>

collection of objects containing the values to be used

Returns:SqlParameterSource[]

an array of SqlParameterSource

Annotations
@SuppressWarnings:rawtypes, unchecked
Since
5.0.2
See Also
MapSqlParameterSource, BeanPropertySqlParameterSource, NamedParameterJdbcTemplate#batchUpdate(String, SqlParameterSource[])
createBatchback to summary
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:Map<String, ?>[]

array of Map instances containing the values to be used

Returns:SqlParameterSource[]

an array of SqlParameterSource

See Also
MapSqlParameterSource, NamedParameterJdbcTemplate#batchUpdate(String, Map[])
extractCaseInsensitiveParameterNamesback to summary
public static Map<String, String> extractCaseInsensitiveParameterNames(SqlParameterSource parameterSource)

Create a Map of case-insensitive parameter names together with the original name.

Parameters
parameterSource:SqlParameterSource

the source of parameter names

Returns:Map<String, String>

the Map that can be used for case-insensitive matching of parameter names

getTypedValueback to summary
public static Object getTypedValue(SqlParameterSource source, String parameterName)

Create a wrapped value if parameter has type information, plain object if not.

Parameters
source:SqlParameterSource

the source of parameter values and type information

parameterName:String

the name of the parameter

Returns:Object

the value object

Annotations
@Nullable
See Also
SqlParameterValue