类 SqlParameterSourceUtils
- java.lang.Object
- org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils
public class SqlParameterSourceUtils extends Object
Class that provides helper methods for the use ofSqlParameterSource
, in particular withNamedParameterJdbcTemplate
.- 从以下版本开始:
- 2.5
- 作者:
- Thomas Risberg, Juergen Hoeller
构造器概要
构造器 构造器 说明 SqlParameterSourceUtils()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static SqlParameterSource[]
createBatch(Object[] beans)
Create an array ofBeanPropertySqlParameterSource
objects populated with data from the values passed in.static SqlParameterSource[]
createBatch(Map<String,?>[] valueMaps)
Create an array ofMapSqlParameterSource
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.
构造器详细资料
SqlParameterSourceUtils
public SqlParameterSourceUtils()
方法详细资料
createBatch
public static SqlParameterSource[] createBatch(Map<String,?>[] valueMaps)
Create an array ofMapSqlParameterSource
objects populated with data from the values passed in. This will define what is included in a batch operation.- 参数:
valueMaps
- array ofMap
instances containing the values to be used- 返回:
- an array of
SqlParameterSource
- 另请参阅:
MapSqlParameterSource
,NamedParameterJdbcTemplate.batchUpdate(String, Map[])
createBatch
public static SqlParameterSource[] createBatch(Object[] beans)
Create an array ofBeanPropertySqlParameterSource
objects populated with data from the values passed in. This will define what is included in a batch operation.- 参数:
beans
- object array of beans containing the values to be used- 返回:
- an array of
SqlParameterSource
- 另请参阅:
BeanPropertySqlParameterSource
,NamedParameterJdbcTemplate.batchUpdate(String, SqlParameterSource[])
getTypedValue
public static Object getTypedValue(SqlParameterSource source, String parameterName)
Create a wrapped value if parameter has type information, plain object if not.- 参数:
source
- the source of parameter values and type informationparameterName
- the name of the parameter- 返回:
- the value object
- 另请参阅:
SqlParameterValue
extractCaseInsensitiveParameterNames
public static Map<String,String> extractCaseInsensitiveParameterNames(SqlParameterSource parameterSource)
Create a Map of case insensitive parameter names together with the original name.- 参数:
parameterSource
- the source of parameter names- 返回:
- the Map that can be used for case insensitive matching of parameter names