类 BeanPropertySqlParameterSource
- java.lang.Object
- org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource
- org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource
- 所有已实现的接口:
SqlParameterSource
public class BeanPropertySqlParameterSource extends AbstractSqlParameterSource
SqlParameterSource
implementation that obtains parameter values from bean properties of a given JavaBean object. The names of the bean properties have to match the parameter names.Uses a Spring BeanWrapper for bean property access underneath.
- 从以下版本开始:
- 2.0
- 作者:
- Thomas Risberg, Juergen Hoeller
- 另请参阅:
NamedParameterJdbcTemplate
,BeanWrapper
字段概要
从接口继承的字段 org.springframework.jdbc.core.namedparam.SqlParameterSource
TYPE_UNKNOWN
构造器概要
构造器 构造器 说明 BeanPropertySqlParameterSource(Object object)
Create a new BeanPropertySqlParameterSource for the given bean.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 String[]
getReadablePropertyNames()
Provide access to the property names of the wrapped bean.int
getSqlType(String paramName)
Derives a default SQL type from the corresponding property type.Object
getValue(String paramName)
Return the parameter value for the requested named parameter.boolean
hasValue(String paramName)
Determine whether there is a value for the specified named parameter.从类继承的方法 org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource
getTypeName, registerSqlType, registerTypeName
构造器详细资料
BeanPropertySqlParameterSource
public BeanPropertySqlParameterSource(Object object)
Create a new BeanPropertySqlParameterSource for the given bean.- 参数:
object
- the bean instance to wrap
方法详细资料
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) throws IllegalArgumentException
从接口复制的说明:SqlParameterSource
Return the parameter value for the requested named parameter.- 参数:
paramName
- the name of the parameter- 返回:
- the value of the specified parameter
- 抛出:
IllegalArgumentException
- if there is no value for the requested parameter
getSqlType
public int getSqlType(String paramName)
Derives a default SQL type from the corresponding property type.- 指定者:
getSqlType
在接口中SqlParameterSource
- 覆盖:
getSqlType
在类中AbstractSqlParameterSource
- 参数:
paramName
- the name of the parameter- 返回:
- the SQL type of the parameter, or
TYPE_UNKNOWN
if not registered - 另请参阅:
StatementCreatorUtils.javaTypeToSqlParameterType(java.lang.Class<?>)
getReadablePropertyNames
public String[] getReadablePropertyNames()
Provide access to the property names of the wrapped bean. Uses support provided in thePropertyAccessor
interface.- 返回:
- an array containing all the known property names