org.springframework.data.jdbc.jms.support.oracle
Class StructDatumMapper<T>

java.lang.Object
  extended by org.springframework.data.jdbc.jms.support.oracle.StructDatumMapper<T>
All Implemented Interfaces:
DatumMapper<T>

public class StructDatumMapper<T>
extends Object
implements DatumMapper<T>

Implementation of the DatumMapper interface. Provides mapping from an ADT STRUCT to a bean based on attribute to property name mapping.

Since:
1.0

Field Summary
protected  org.apache.commons.logging.Log logger
          Logger available to subclasses
protected  String typeName
          The class we are mapping to
 
Constructor Summary
StructDatumMapper(String typeName, Class<T> targetClass)
          Constructor that takes the type name and a parameter with the class that the data should be mapped from/into.
StructDatumMapper(String typeName, StructMapper<T> mapper)
          Constructor that takes the type name and a StructMapper implemenatation that will handle the mapping to and from STRUCT values.
 
Method Summary
 T fromDatum(oracle.sql.Datum datum)
          Extract the Datum content and return it in a domain class instance.
 oracle.sql.Datum toDatum(T source, Connection conn)
          Create a Datum object based on the passed in object using the connection if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

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


typeName

protected String typeName
The class we are mapping to

Constructor Detail

StructDatumMapper

public StructDatumMapper(String typeName,
                         StructMapper<T> mapper)
Constructor that takes the type name and a StructMapper implemenatation that will handle the mapping to and from STRUCT values.

Parameters:
typeName - name of the database type
mapper - StructMapper implementation to do the mapping

StructDatumMapper

public StructDatumMapper(String typeName,
                         Class<T> targetClass)
Constructor that takes the type name and a parameter with the class that the data should be mapped from/into. Using this constructor results in the BeanPropertyStructMapper being used for the mapping.

Parameters:
typeName - name of the database type
targetClass - JavaBean class that STRUCT attributes will be mapped to
Method Detail

toDatum

public oracle.sql.Datum toDatum(T source,
                                Connection conn)
                         throws SQLException
Description copied from interface: DatumMapper
Create a Datum object based on the passed in object using the connection if necessary.

Specified by:
toDatum in interface DatumMapper<T>
Parameters:
source - the object containing tha data to be used
conn - the database Connection that can be used to create database specific instances
Returns:
the created Datum
Throws:
SQLException

fromDatum

public T fromDatum(oracle.sql.Datum datum)
            throws SQLException
Description copied from interface: DatumMapper
Extract the Datum content and return it in a domain class instance.

Specified by:
fromDatum in interface DatumMapper<T>
Parameters:
datum - the Datum containing the data
Returns:
the instance of the domain class populated with extracted data from the Datum
Throws:
SQLException