站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

BeanPropertySqlParameterSource (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.jdbc.core.namedparam
Class BeanPropertySqlParameterSource

java.lang.Object
  extended by org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource
      extended by org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource
All Implemented Interfaces:
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.

Since:
2.0
Author:
Thomas Risberg, Juergen Hoeller
See Also:
NamedParameterJdbcTemplate, BeanWrapper

Field Summary
 
Fields inherited from interface org.springframework.jdbc.core.namedparam.SqlParameterSource
TYPE_UNKNOWN
 
Constructor Summary
BeanPropertySqlParameterSource(Object object)
          Create a new BeanPropertySqlParameterSource for the given bean.
 
Method Summary
 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.
 
Methods inherited from class org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource
getSqlType, registerSqlType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPropertySqlParameterSource

public BeanPropertySqlParameterSource(Object object)
Create a new BeanPropertySqlParameterSource for the given bean.

Parameters:
object - the bean instance to wrap
Method Detail

hasValue

public boolean hasValue(String paramName)
Description copied from interface: SqlParameterSource
Determine whether there is a value for the specified named parameter.

Parameters:
paramName - the name of the parameter
Returns:
whether there is a value defined

getValue

public Object getValue(String paramName)
                throws IllegalArgumentException
Description copied from interface: SqlParameterSource
Return the parameter value for the requested named parameter.

Parameters:
paramName - the name of the parameter
Returns:
the value of the specified parameter
Throws:
IllegalArgumentException - if there is no value for the requested parameter

The Spring Framework

Copyright © 2002-2007 The Spring Framework.