|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource org.springframework.jdbc.core.namedparam.MapSqlParameterSource
public class MapSqlParameterSource
SqlParameterSource
implementation that holds a given Map of parameters.
This class is intended for passing in a simple Map of parameter values
to the methods of the NamedParameterJdbcTemplate
class.
The addValue
methods on this class will make adding several
values easier. The methods return a reference to the MapSqlParameterSource
itself, so you can chain several method calls together within a single statement.
addValue(String, Object)
,
addValue(String, Object, int)
,
AbstractSqlParameterSource.registerSqlType(java.lang.String, int)
,
NamedParameterJdbcTemplate
Field Summary |
---|
Fields inherited from interface org.springframework.jdbc.core.namedparam.SqlParameterSource |
---|
TYPE_UNKNOWN |
Constructor Summary | |
---|---|
MapSqlParameterSource()
Create an empty MapSqlParameterSource, with values to be added via addValue . |
|
MapSqlParameterSource(Map<String,?> values)
Create a new MapSqlParameterSource based on a Map. |
|
MapSqlParameterSource(String paramName,
Object value)
Create a new MapSqlParameterSource, with one value comprised of the supplied arguments. |
Method Summary | |
---|---|
MapSqlParameterSource |
addValue(String paramName,
Object value)
Add a parameter to this parameter source. |
MapSqlParameterSource |
addValue(String paramName,
Object value,
int sqlType)
Add a parameter to this parameter source. |
MapSqlParameterSource |
addValue(String paramName,
Object value,
int sqlType,
String typeName)
Add a parameter to this parameter source. |
MapSqlParameterSource |
addValues(Map<String,?> values)
Add a Map of parameters to this parameter source. |
Object |
getValue(String paramName)
Return the parameter value for the requested named parameter. |
Map<String,Object> |
getValues()
Expose the current parameter values as read-only Map. |
boolean |
hasValue(String paramName)
Determine whether there is a value for the specified named parameter. |
Methods inherited from class org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource |
---|
getSqlType, getTypeName, registerSqlType, registerTypeName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapSqlParameterSource()
addValue
.
addValue(String, Object)
public MapSqlParameterSource(String paramName, Object value)
paramName
- the name of the parametervalue
- the value of the parameteraddValue(String, Object)
public MapSqlParameterSource(Map<String,?> values)
values
- a Map holding existing parameter values (can be null
)Method Detail |
---|
public MapSqlParameterSource addValue(String paramName, Object value)
paramName
- the name of the parametervalue
- the value of the parameter
public MapSqlParameterSource addValue(String paramName, Object value, int sqlType)
paramName
- the name of the parametervalue
- the value of the parametersqlType
- the SQL type of the parameter
public MapSqlParameterSource addValue(String paramName, Object value, int sqlType, String typeName)
paramName
- the name of the parametervalue
- the value of the parametersqlType
- the SQL type of the parametertypeName
- the type name of the parameter
public MapSqlParameterSource addValues(Map<String,?> values)
values
- a Map holding existing parameter values (can be null
)
public Map<String,Object> getValues()
public boolean hasValue(String paramName)
SqlParameterSource
paramName
- the name of the parameter
public Object getValue(String paramName)
SqlParameterSource
paramName
- the name of the parameter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |