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), registerSqlType, NamedParameterJdbcTemplate
| Access | Constructor and Description |
|---|---|
| public | |
| public | MapSqlParameterSource(String
the name of the parameter paramName, Object the value of the parameter value)Create a new MapSqlParameterSource, with one value comprised of the supplied arguments. |
| public | MapSqlParameterSource(Map<String, ?>
a Map holding existing parameter values (can be values)null)Create a new MapSqlParameterSource based on a Map. |
| Modifier and Type | Method and Description |
|---|---|
| public MapSqlParameterSource | |
| public MapSqlParameterSource | |
| public MapSqlParameterSource | Returns: a reference to this parameter source, so it's possible to chain several calls togetherthe name of the parameter paramName, Object the value of the parameter value, int the SQL type of the parameter sqlType, String the type name of the parameter typeName)Add a parameter to this parameter source. |
| public MapSqlParameterSource | |
| public String[] | getParameterNames()
Overrides default org. |
| public Object | getValue(String
the name of the parameter paramName)Implements org. |
| public Map | |
| public boolean | hasValue(String
the name of the parameter paramName)Implements org. |
| public boolean |
| values | back to summary |
|---|---|
| private final Map<String, Object> values | |
| MapSqlParameterSource | back to summary |
|---|---|
| public MapSqlParameterSource() Create an empty MapSqlParameterSource,
with values to be added via
| |
| MapSqlParameterSource | back to summary |
|---|---|
| public MapSqlParameterSource(String paramName, Object value) Create a new MapSqlParameterSource, with one value comprised of the supplied arguments.
| |
| MapSqlParameterSource | back to summary |
|---|---|
| public MapSqlParameterSource(Map<String, ?> values) Create a new MapSqlParameterSource based on a Map. | |
| addValue | back to summary |
|---|---|
| public MapSqlParameterSource addValue(String paramName, Object value) Add a parameter to this parameter source.
| |
| addValue | back to summary |
|---|---|
| public MapSqlParameterSource addValue(String paramName, Object value, int sqlType) Add a parameter to this parameter source.
| |
| addValue | back to summary |
|---|---|
| public MapSqlParameterSource addValue(String paramName, Object value, int sqlType, String typeName) Add a parameter to this parameter source.
| |
| addValues | back to summary |
|---|---|
| public MapSqlParameterSource addValues(Map<String, ?> values) Add a Map of parameters to this parameter source.
| |
| getParameterNames | back to summary |
|---|---|
| public String[] getParameterNames() Overrides default org. Doc from org. Enumerate all available parameter names if possible. This is an optional operation, primarily for use with
| |
| getValue | back to summary |
|---|---|
| public Object getValue(String paramName) Implements org. Doc from org. Return the parameter value for the requested named parameter. | |
| getValues | back to summary |
|---|---|
| public Map Expose the current parameter values as read-only Map. | |
| hasValue | back to summary |
|---|---|
| public boolean hasValue(String paramName) Implements org. Doc from org. Determine whether there is a value for the specified named parameter. | |
| hasValues | back to summary |
|---|---|
| public boolean hasValues() Return whether this parameter source has been configured with any values.
| |