Interface SqlParameterSource
- All Known Implementing Classes:
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
for
NamedParameterJdbcTemplate 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.
- Since:
- 2.0
- Author:
- Thomas Risberg, Juergen Hoeller
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant that indicates an unknown (or unspecified) SQL type. -
Method Summary
Modifier and TypeMethodDescriptiondefault String[]Enumerate all available parameter names if possible.default intgetSqlType(String paramName) Determine the SQL type for the specified named parameter.default StringgetTypeName(String paramName) Determine the type name for the specified named parameter.Return the parameter value for the requested named parameter.booleanDetermine whether there is a value for the specified named parameter.
-
Field Details
-
TYPE_UNKNOWN
static final int TYPE_UNKNOWNConstant that indicates an unknown (or unspecified) SQL type. To be returned fromgetTypewhen no specific SQL type known.
-
-
Method Details
-
hasValue
Determine whether there is a value for the specified named parameter.- Parameters:
paramName- the name of the parameter- Returns:
- whether there is a value defined
-
getValue
Return the parameter value for the requested named parameter.- Parameters:
paramName- the name of the parameter- Returns:
- the value of the specified parameter
- Throws:
IllegalArgumentException- if there is no value for the requested parameter
-
getSqlType
Determine the SQL type for the specified named parameter.- Parameters:
paramName- the name of the parameter- Returns:
- the SQL type of the specified parameter,
or
TYPE_UNKNOWNif not known - See Also:
-
getTypeName
Determine the type name for the specified named parameter.- Parameters:
paramName- the name of the parameter- Returns:
- the type name of the specified parameter,
or
nullif not known
-
getParameterNames
Enumerate all available parameter names if possible.This is an optional operation, primarily for use with
SimpleJdbcInsertandSimpleJdbcCall.- Returns:
- the array of parameter names, or
nullif not determinable - Since:
- 5.0.3
- See Also:
-