net.hasor.db.jdbc.core.mapper
类 BeanPropertyRowMapper<T>

java.lang.Object
  继承者 net.hasor.db.jdbc.core.mapper.AbstractRowMapper<T>
      继承者 net.hasor.db.jdbc.core.mapper.BeanPropertyRowMapper<T>
所有已实现的接口:
RowMapper<T>

public class BeanPropertyRowMapper<T>
extends AbstractRowMapper<T>

用于 POJO 的 RowMapper

版本:
: 2013-12-18
作者:
赵永春(zyc@hasor.net)

构造方法摘要
BeanPropertyRowMapper()
          Create a new BeanPropertyRowMapper.
BeanPropertyRowMapper(Class<T> requiredType)
          Create a new BeanPropertyRowMapper.
 
方法摘要
protected  Object getColumnValue(ResultSet rs, int index, Class<?> requiredType)
          取得指定列的值
 boolean isCaseInsensitive()
           
 T mapRow(ResultSet rs, int rowNum)
          实现这个方法为结果集的一行记录进行转换,并将最终转换结果返回。
static
<T> BeanPropertyRowMapper<T>
newInstance(Class<T> mappedClass)
          Static factory method to create a new BeanPropertyRowMapper (with the mapped class specified only once).
 void setCaseInsensitive(boolean caseInsensitive)
           
 void setRequiredType(Class<T> requiredType)
          Set the type that each result object is expected to match.
 
从类 net.hasor.db.jdbc.core.mapper.AbstractRowMapper 继承的方法
convertValueToRequiredType, getResultSetValue
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

BeanPropertyRowMapper

public BeanPropertyRowMapper()
Create a new BeanPropertyRowMapper.


BeanPropertyRowMapper

public BeanPropertyRowMapper(Class<T> requiredType)
Create a new BeanPropertyRowMapper.

方法详细信息

setRequiredType

public void setRequiredType(Class<T> requiredType)
Set the type that each result object is expected to match.

If not specified, the column value will be exposed as returned by the JDBC driver.


isCaseInsensitive

public boolean isCaseInsensitive()

setCaseInsensitive

public void setCaseInsensitive(boolean caseInsensitive)

mapRow

public T mapRow(ResultSet rs,
                int rowNum)
         throws SQLException
从接口 RowMapper 复制的描述
实现这个方法为结果集的一行记录进行转换,并将最终转换结果返回。如果返回为 null 等同于忽略该行。 需要注意,不要调用结果集的 next() 方法。

参数:
rs - 记录集
rowNum - 当前记录的行号
抛出:
SQLException

getColumnValue

protected Object getColumnValue(ResultSet rs,
                                int index,
                                Class<?> requiredType)
                         throws SQLException
取得指定列的值

抛出:
SQLException

newInstance

public static <T> BeanPropertyRowMapper<T> newInstance(Class<T> mappedClass)
Static factory method to create a new BeanPropertyRowMapper (with the mapped class specified only once).

参数:
mappedClass - the class that each row should be mapped to


Copyright © 2014. All rights reserved.