org.springframework.jdbc.core.namedparam
Interface SqlParameterSource

All Known Implementing Classes:
AbstractSqlParameterSource, BeanPropertySqlParameterSource, 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:
NamedParameterJdbcOperations, NamedParameterJdbcTemplate, MapSqlParameterSource, BeanPropertySqlParameterSource

Field Summary
static int TYPE_UNKNOWN
          Constant that indicates an unknown (or unspecified) SQL type.
 
Method Summary
 int getSqlType(java.lang.String paramName)
          Determine the SQL type for the specified named parameter.
 java.lang.String getTypeName(java.lang.String paramName)
          Determine the type ane for the specified named parameter.
 java.lang.Object getValue(java.lang.String paramName)
          Return the parameter value for the requested named parameter.
 boolean hasValue(java.lang.String paramName)
          Determine whether there is a value for the specified named parameter.
 

Field Detail

TYPE_UNKNOWN

static final int TYPE_UNKNOWN
Constant that indicates an unknown (or unspecified) SQL type. To be returned from getType when no specific SQL type known.

See Also:
getSqlType(java.lang.String), Types, Constant Field Values
Method Detail

hasValue

boolean hasValue(java.lang.String paramName)
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

java.lang.Object getValue(java.lang.String paramName)
                          throws java.lang.IllegalArgumentException
Return the parameter value for the requested named parameter.

Parameters:
paramName - the name of the parameter
Returns:
the value of the specified parameter
Throws:
java.lang.IllegalArgumentException - if there is no value for the requested parameter

getSqlType

int getSqlType(java.lang.String paramName)
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_UNKNOWN if not known
See Also:
TYPE_UNKNOWN

getTypeName

java.lang.String getTypeName(java.lang.String paramName)
Determine the type ane for the specified named parameter.

Parameters:
paramName - the name of the parameter
Returns:
the type name of the specified parameter, or null if not known