public interface SqlParameterSource
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.
NamedParameterJdbcOperations
,
NamedParameterJdbcTemplate
,
MapSqlParameterSource
,
BeanPropertySqlParameterSource
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_UNKNOWN
Constant that indicates an unknown (or unspecified) SQL type.
|
Modifier and Type | Method and Description |
---|---|
default String[] |
getParameterNames()
Extract all available parameter names if possible.
|
default int |
getSqlType(String paramName)
Determine the SQL type for the specified named parameter.
|
default 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.
|
static final int TYPE_UNKNOWN
getType
when no specific SQL type known.getSqlType(java.lang.String)
,
Types
,
Constant Field Valuesboolean hasValue(String paramName)
paramName
- the name of the parameter@Nullable Object getValue(String paramName) throws IllegalArgumentException
paramName
- the name of the parameterIllegalArgumentException
- if there is no value for the requested parameterdefault int getSqlType(String paramName)
paramName
- the name of the parameterTYPE_UNKNOWN
if not knownTYPE_UNKNOWN
@Nullable default String getTypeName(String paramName)
paramName
- the name of the parameternull
if not known@Nullable default String[] getParameterNames()
This is an optional operation, primarily for use with
SimpleJdbcInsert
and SimpleJdbcCall
.
null
if not determinableSqlParameterSourceUtils.extractCaseInsensitiveParameterNames(org.springframework.jdbc.core.namedparam.SqlParameterSource)