接口 SqlParameterSource
- 所有已知实现类:
AbstractSqlParameterSource
,BeanPropertySqlParameterSource
,EmptySqlParameterSource
,MapSqlParameterSource
public interface SqlParameterSource
Interface that defines common functionality for objects that can offer parameter values for named SQL parameters, serving as argument forNamedParameterJdbcTemplate
operations.This interface allows for the specification of SQL type in addition to parameter values. All parameter values and types are identified by specifying the name of the parameter.
Intended to wrap various implementations like a Map or a JavaBean with a consistent interface.
- 从以下版本开始:
- 2.0
- 作者:
- Thomas Risberg, Juergen Hoeller
- 另请参阅:
NamedParameterJdbcOperations
,NamedParameterJdbcTemplate
,MapSqlParameterSource
,BeanPropertySqlParameterSource
字段概要
字段 修饰符和类型 字段 说明 static int
TYPE_UNKNOWN
Constant that indicates an unknown (or unspecified) SQL type.
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 int
getSqlType(String paramName)
Determine the SQL type for the specified named parameter.String
getTypeName(String paramName)
Determine the type name for the specified named parameter.Object
getValue(String paramName)
Return the parameter value for the requested named parameter.boolean
hasValue(String paramName)
Determine whether there is a value for the specified named parameter.
字段详细资料
TYPE_UNKNOWN
static final int TYPE_UNKNOWN
Constant that indicates an unknown (or unspecified) SQL type. To be returned fromgetType
when no specific SQL type known.
方法详细资料
hasValue
boolean hasValue(String paramName)
Determine whether there is a value for the specified named parameter.- 参数:
paramName
- the name of the parameter- 返回:
- whether there is a value defined
getValue
Object getValue(String paramName) throws IllegalArgumentException
Return the parameter value for the requested named parameter.- 参数:
paramName
- the name of the parameter- 返回:
- the value of the specified parameter
- 抛出:
IllegalArgumentException
- if there is no value for the requested parameter
getSqlType
int getSqlType(String paramName)
Determine the SQL type for the specified named parameter.- 参数:
paramName
- the name of the parameter- 返回:
- the SQL type of the specified parameter, or
TYPE_UNKNOWN
if not known - 另请参阅:
TYPE_UNKNOWN
getTypeName
String getTypeName(String paramName)
Determine the type name for the specified named parameter.- 参数:
paramName
- the name of the parameter- 返回:
- the type name of the specified parameter, or
null
if not known