public abstract class AbstractSqlParameterSource extends Object implements SqlParameterSource
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)
.SqlParameterSource.hasValue(String)
,
SqlParameterSource.getValue(String)
,
SqlParameterSource.getParameterNames()
TYPE_UNKNOWN
Constructor and Description |
---|
AbstractSqlParameterSource() |
Modifier and Type | Method and Description |
---|---|
int |
getSqlType(String paramName)
Return the SQL type for the given parameter, if registered.
|
String |
getTypeName(String paramName)
Return the type name for the given parameter, if registered.
|
void |
registerSqlType(String paramName,
int sqlType)
Register an SQL type for the given parameter.
|
void |
registerTypeName(String paramName,
String typeName)
Register an SQL type for the given parameter.
|
String |
toString()
Enumerate the parameter names and values with their corresponding SQL type if available,
or just return the simple
SqlParameterSource implementation class name otherwise. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getParameterNames, getValue, hasValue
public void registerSqlType(String paramName, int sqlType)
paramName
- the name of the parametersqlType
- the SQL type of the parameterpublic void registerTypeName(String paramName, String typeName)
paramName
- the name of the parametertypeName
- the type name of the parameterpublic int getSqlType(String paramName)
getSqlType
in interface SqlParameterSource
paramName
- the name of the parameterTYPE_UNKNOWN
if not registeredSqlParameterSource.TYPE_UNKNOWN
@Nullable public String getTypeName(String paramName)
getTypeName
in interface SqlParameterSource
paramName
- the name of the parameternull
if not registeredpublic String toString()
SqlParameterSource
implementation class name otherwise.toString
in class Object
SqlParameterSource.getParameterNames()