|
Spring Data JDBC Extensions | ||||||||
| 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<T>
public class BeanPropertyStructMapper<T>
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<T> |
mappedClass
The class we are mapping to |
| Constructor Summary | |
|---|---|
BeanPropertyStructMapper()
Create a new BeanPropertyRowMapper. |
|
BeanPropertyStructMapper(Class<T> mappedClass)
Create a new BeanPropertyRowMapper. |
|
| Method Summary | ||
|---|---|---|
T |
fromStruct(oracle.sql.STRUCT struct)
Extract the values for all attributes in the struct. |
|
Class<T> |
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<T> mappedClass)
Initialize the mapping metadata for the given class. |
|
static
|
newInstance(Class<T> mappedClass)
Static factory method to create a new BeanPropertyStructMapper (with the mapped class specified only once). |
|
void |
setMappedClass(Class<T> mappedClass)
Set the class that each row should be mapped to. |
|
oracle.sql.STRUCT |
toStruct(T source,
Connection conn,
String typeName)
Create a struct of the defined type and populate it with values from the passed in source 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<T> mappedClass
| Constructor Detail |
|---|
public BeanPropertyStructMapper()
setMappedClass(java.lang.Class) public BeanPropertyStructMapper(Class<T> mappedClass)
mappedClass - the class that each row should be mapped to.| Method Detail |
|---|
public void setMappedClass(Class<T> mappedClass)
protected void initialize(Class<T> mappedClass)
mappedClass - the mapped class.public final Class<T> getMappedClass()
public final Map<String,PropertyDescriptor> getMappedFields()
public oracle.sql.STRUCT toStruct(T source,
Connection conn,
String typeName)
throws SQLException
StructMapper
toStruct in interface StructMapper<T>source - instance containing the values to mapconn - database connection to be used to create the STRUCTtypeName - name of the STRUCT type
SQLException
public T fromStruct(oracle.sql.STRUCT struct)
throws SQLException
Utilizes public setters and result set metadata.
fromStruct in interface StructMapper<T>struct - 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 initializepublic static <T> BeanPropertyStructMapper<T> newInstance(Class<T> mappedClass)
mappedClass - the class that each row should be mapped to
|
Spring Data JDBC Extensions | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||