|
Spring Data JDBC Extensions Support | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.data.jdbc.support.oracle.BeanPropertyStructMapper
public class BeanPropertyStructMapper
Mapping implementation that converts struct attributes 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.
Attribute 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.
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses |
protected Class<?> |
mappedClass
The class we are mapping to |
| Constructor Summary | |
|---|---|
BeanPropertyStructMapper()
Create a new BeanPropertyRowMapper. |
|
BeanPropertyStructMapper(Class<?> mappedClass)
Create a new BeanPropertyRowMapper. |
|
| Method Summary | |
|---|---|
Object |
fromStruct(oracle.sql.STRUCT struct)
Extract the values for all attributes in the struct. |
Class<?> |
getMappedClass()
Get the class that we are mapping to. |
Map<String,PropertyDescriptor> |
getMappedFields()
Get the fields that we are mapping to. |
protected void |
initBeanWrapper(BeanWrapper bw)
Initialize the given BeanWrapper to be used for row mapping. |
protected void |
initialize(Class<?> mappedClass)
Initialize the mapping metadata for the given class. |
void |
setMappedClass(Class<?> mappedClass)
Set the class that each row should be mapped to. |
oracle.sql.STRUCT |
toStruct(Object object,
Connection conn,
String typeName)
Create a struct of the defined type and populate it with values from the passed in object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log logger
protected Class<?> mappedClass
| Constructor Detail |
|---|
public BeanPropertyStructMapper()
setMappedClass(java.lang.Class>)public BeanPropertyStructMapper(Class<?> mappedClass)
mappedClass - the class that each row should be mapped to.| Method Detail |
|---|
public void setMappedClass(Class<?> mappedClass)
protected void initialize(Class<?> mappedClass)
mappedClass - the mapped class.public final Class<?> getMappedClass()
public final Map<String,PropertyDescriptor> getMappedFields()
public oracle.sql.STRUCT toStruct(Object object,
Connection conn,
String typeName)
throws SQLException
StructMapper
toStruct in interface StructMapperobject - instance containng the values to mapconn - database connection to be used to create the STRUCTtypeName - name of the STRUCT type
SQLException
public Object fromStruct(oracle.sql.STRUCT struct)
throws SQLException
Utilizes public setters and result set metadata.
fromStruct in interface StructMapperstruct - the STRUCT containing attribute values to be used
SQLExceptionResultSetMetaDataprotected void initBeanWrapper(BeanWrapper bw)
The default implementation is empty. Can be overridden in subclasses.
bw - the BeanWrapper to initialize
|
Spring Data JDBC Extensions Support | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||