net.paoding.rose.jade.rowmapper
类 BeanPropertyRowMapper

java.lang.Object
  继承者 net.paoding.rose.jade.rowmapper.BeanPropertyRowMapper
所有已实现的接口:
org.springframework.jdbc.core.RowMapper

public class BeanPropertyRowMapper
extends Object
implements org.springframework.jdbc.core.RowMapper

RowMapper implementation that converts a row into a new instance of the specified mapped target class. The mapped target class must be a top-level class and it must have a default or no-arg constructor.

Column values are mapped based on matching the column name as obtained from result set metadata to public setters for the corresponding properties. The names are matched either directly or by transforming a name separating the parts with underscores to the same name using "camel" case.

Mapping is provided for fields in the target class for many common types, e.g.: String, boolean, Boolean, byte, Byte, short, Short, int, Integer, long, Long, float, Float, double, Double, BigDecimal, java.util.Date, etc.

To facilitate mapping between columns and fields that don't have matching names, try using column aliases in the SQL statement like "select fname as first_name from customer".

Please note that this class is designed to provide convenience rather than high performance. For best performance consider using a custom RowMapper.

从以下版本开始:
2.5
作者:
Thomas Risberg, Juergen Hoeller, 王志亮 [qieqie.wang@gmail.com]

字段摘要
protected  org.apache.commons.logging.Log logger
          Logger available to subclasses
 
构造方法摘要
BeanPropertyRowMapper(Class<?> mappedClass, boolean checkColumns, boolean checkProperties)
          Create a new BeanPropertyRowMapper, accepting unpopulated properties in the target bean.
 
方法摘要
protected  void initialize()
          Initialize the mapping metadata for the given class.
 Object mapRow(ResultSet rs, int rowNumber)
          Extract the values for all columns in the current row.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

logger

protected final org.apache.commons.logging.Log logger
Logger available to subclasses

构造方法详细信息

BeanPropertyRowMapper

public BeanPropertyRowMapper(Class<?> mappedClass,
                             boolean checkColumns,
                             boolean checkProperties)
Create a new BeanPropertyRowMapper, accepting unpopulated properties in the target bean.

参数:
mappedClass - the class that each row should be mapped to
方法详细信息

initialize

protected void initialize()
Initialize the mapping metadata for the given class.

参数:
mappedClass - the mapped class.

mapRow

public Object mapRow(ResultSet rs,
                     int rowNumber)
              throws SQLException
Extract the values for all columns in the current row.

Utilizes public setters and result set metadata.

指定者:
接口 org.springframework.jdbc.core.RowMapper 中的 mapRow
抛出:
SQLException
另请参见:
ResultSetMetaData


Copyright © 2012. All Rights Reserved.