Class AbstractSqlParameterSource
java.lang.Object
org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource
- All Implemented Interfaces:
SqlParameterSource
- Direct Known Subclasses:
BeanPropertySqlParameterSource,MapSqlParameterSource
Abstract base class for
SqlParameterSource implementations.
Provides registration of SQL types per parameter and a friendly
toString representation enumerating all parameters for
a SqlParameterSource implementing SqlParameterSource.getParameterNames().
Concrete subclasses must implement SqlParameterSource.hasValue(java.lang.String) and SqlParameterSource.getValue(java.lang.String).- Since:
- 2.0
- Author:
- Juergen Hoeller, Jens Schauder
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.jdbc.core.namedparam.SqlParameterSource
TYPE_UNKNOWN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetSqlType(String paramName) Return the SQL type for the given parameter, if registered.getTypeName(String paramName) Return the type name for the given parameter, if registered.voidregisterSqlType(String paramName, int sqlType) Register an SQL type for the given parameter.voidregisterTypeName(String paramName, String typeName) Register an SQL type for the given parameter.toString()Enumerate the parameter names and values with their corresponding SQL type if available, or just return the simpleSqlParameterSourceimplementation class name otherwise.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.jdbc.core.namedparam.SqlParameterSource
getParameterNames, getValue, hasValue
-
Constructor Details
-
AbstractSqlParameterSource
public AbstractSqlParameterSource()
-
-
Method Details
-
registerSqlType
Register an SQL type for the given parameter.- Parameters:
paramName- the name of the parametersqlType- the SQL type of the parameter
-
registerTypeName
Register an SQL type for the given parameter.- Parameters:
paramName- the name of the parametertypeName- the type name of the parameter
-
getSqlType
Return the SQL type for the given parameter, if registered.- Specified by:
getSqlTypein interfaceSqlParameterSource- Parameters:
paramName- the name of the parameter- Returns:
- the SQL type of the parameter,
or
TYPE_UNKNOWNif not registered - See Also:
-
getTypeName
Return the type name for the given parameter, if registered.- Specified by:
getTypeNamein interfaceSqlParameterSource- Parameters:
paramName- the name of the parameter- Returns:
- the type name of the parameter,
or
nullif not registered
-
toString
Enumerate the parameter names and values with their corresponding SQL type if available, or just return the simpleSqlParameterSourceimplementation class name otherwise.
-