public class TinyBeanPropertyRowMapper<T> extends BaseMappedClass<T> implements org.springframework.jdbc.core.RowMapper<T>
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses
|
mappedClass, mappedFields, mappedProperties
Constructor and Description |
---|
TinyBeanPropertyRowMapper() |
TinyBeanPropertyRowMapper(Class<T> requiredType) |
TinyBeanPropertyRowMapper(Class<T> mappedClass,
boolean checkFullyPopulated) |
Modifier and Type | Method and Description |
---|---|
protected Object |
getColumnValue(ResultSet rs,
int index,
PropertyDescriptor pd)
Retrieve a JDBC object value for the specified column.
|
protected void |
initBeanWrapper(org.springframework.beans.BeanWrapper bw) |
boolean |
isCheckFullyPopulated()
Return whether we're strictly validating that all bean properties have
been mapped from corresponding database fields.
|
boolean |
isPrimitivesDefaultedForNullValue()
Return whether we're defaulting Java primitives in the case of mapping a
null value from corresponding database fields.
|
T |
mapRow(ResultSet rs,
int rowNumber) |
static <T> TinyBeanPropertyRowMapper<T> |
newInstance(Class<T> mappedClass) |
void |
setCheckFullyPopulated(boolean checkFullyPopulated)
Set whether we're strictly validating that all bean properties have been
mapped from corresponding database fields.
|
void |
setPrimitivesDefaultedForNullValue(boolean primitivesDefaultedForNullValue)
Set whether we're defaulting Java primitives in the case of mapping a
null value from corresponding database fields.
|
getMappedClass, getMappedFields, initialize, lowerCaseName, setMappedClass, underscoreName
protected final org.apache.commons.logging.Log logger
public TinyBeanPropertyRowMapper()
public TinyBeanPropertyRowMapper(Class<T> mappedClass, boolean checkFullyPopulated)
public static <T> TinyBeanPropertyRowMapper<T> newInstance(Class<T> mappedClass)
protected void initBeanWrapper(org.springframework.beans.BeanWrapper bw)
public T mapRow(ResultSet rs, int rowNumber) throws SQLException
mapRow
in interface org.springframework.jdbc.core.RowMapper<T>
SQLException
public boolean isCheckFullyPopulated()
public void setCheckFullyPopulated(boolean checkFullyPopulated)
Default is false
, accepting unpopulated properties in the target
bean.
public boolean isPrimitivesDefaultedForNullValue()
public void setPrimitivesDefaultedForNullValue(boolean primitivesDefaultedForNullValue)
Default is false
, throwing an exception when nulls are mapped to
Java primitives.
protected Object getColumnValue(ResultSet rs, int index, PropertyDescriptor pd) throws SQLException
The default implementation calls
JdbcUtils.getResultSetValue(ResultSet, int, Class)
.
Subclasses may override this to check specific value types upfront, or to
post-process values return from getResultSetValue
.
rs
- is the ResultSet holding the dataindex
- is the column indexpd
- the bean property that each result object is expected to match
(or null
if none specified)SQLException
- in case of extraction failureJdbcUtils.getResultSetValue(ResultSet,
int, Class)
Copyright © 2006–2018 TinyGroup. All rights reserved.