net.hasor.jdbc.core.source
类 MapSqlParameterSource

java.lang.Object
  继承者 net.hasor.jdbc.core.source.AbstractSqlParameterSource
      继承者 net.hasor.jdbc.core.source.MapSqlParameterSource
所有已实现的接口:
SqlParameterSource

public class MapSqlParameterSource
extends AbstractSqlParameterSource

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 NamedJdbcTemplate 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.

从以下版本开始:
2.0
作者:
Thomas Risberg, Juergen Hoeller
另请参见:
addValue(String, Object), addValue(String, Object, int), AbstractSqlParameterSource.registerSqlType(java.lang.String, int), NamedJdbcTemplate

字段摘要
 
从接口 net.hasor.jdbc.SqlParameterSource 继承的字段
TYPE_UNKNOWN
 
构造方法摘要
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.
 
方法摘要
 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.
 
从类 net.hasor.jdbc.core.source.AbstractSqlParameterSource 继承的方法
getSqlType, getTypeName, registerSqlType, registerTypeName
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

MapSqlParameterSource

public MapSqlParameterSource()
Create an empty MapSqlParameterSource, with values to be added via addValue.

另请参见:
addValue(String, Object)

MapSqlParameterSource

public MapSqlParameterSource(String paramName,
                             Object value)
Create a new MapSqlParameterSource, with one value comprised of the supplied arguments.

参数:
paramName - the name of the parameter
value - the value of the parameter
另请参见:
addValue(String, Object)

MapSqlParameterSource

public MapSqlParameterSource(Map<String,?> values)
Create a new MapSqlParameterSource based on a Map.

参数:
values - a Map holding existing parameter values (can be null)
方法详细信息

addValue

public MapSqlParameterSource addValue(String paramName,
                                      Object value)
Add a parameter to this parameter source.

参数:
paramName - the name of the parameter
value - the value of the parameter
返回:
a reference to this parameter source, so it's possible to chain several calls together

addValue

public MapSqlParameterSource addValue(String paramName,
                                      Object value,
                                      int sqlType)
Add a parameter to this parameter source.

参数:
paramName - the name of the parameter
value - the value of the parameter
sqlType - the SQL type of the parameter
返回:
a reference to this parameter source, so it's possible to chain several calls together

addValue

public MapSqlParameterSource addValue(String paramName,
                                      Object value,
                                      int sqlType,
                                      String typeName)
Add a parameter to this parameter source.

参数:
paramName - the name of the parameter
value - the value of the parameter
sqlType - the SQL type of the parameter
typeName - the type name of the parameter
返回:
a reference to this parameter source, so it's possible to chain several calls together

addValues

public MapSqlParameterSource addValues(Map<String,?> values)
Add a Map of parameters to this parameter source.

参数:
values - a Map holding existing parameter values (can be null)
返回:
a reference to this parameter source, so it's possible to chain several calls together

getValues

public Map<String,Object> getValues()
Expose the current parameter values as read-only Map.


hasValue

public boolean hasValue(String paramName)
从接口 SqlParameterSource 复制的描述
Determine whether there is a value for the specified named parameter.

参数:
paramName - the name of the parameter
返回:
whether there is a value defined

getValue

public Object getValue(String paramName)
从接口 SqlParameterSource 复制的描述
Return the parameter value for the requested named parameter.

参数:
paramName - the name of the parameter
返回:
the value of the specified parameter


Copyright © 2013-2014. All Rights Reserved.