Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change 
notification.

The following page has been changed by KevinWilliams:
http://wiki.apache.org/ws/ColumnConverters

------------------------------------------------------------------------------
- Sometimes it is desireable to modify a column value retreived from a database 
column '''before''' it is stored into a !DataObject property.
+ Sometimes it is desireable to modify a column value retreived from a database 
column '''before''' it is stored into a !DataObject property.  One example 
might be a database column with possible values '0' or '1' but the desired 
!DataObject property is 'false' or 'true'.  Another example might be a String 
property that should be obfuscated or encryted before it is stored into a 
column.
  
+ The RDB DAS provides a simple "converter" framework that can be used for 
these cases and others.  To use this framework the application developer must 
provide a new Converter class to provide the desired transformations from 
column to property and from property back to column.  The provided converter 
must implement the following interface:
+ {{{
+ package org.apache.tuscany.das.rdb;
+ 
+ /**
+  * A lightweight Table-column <--> DataObject-property converter framework. 
Converters allow a user to 
+  * insert a transformation between a column value and is destination 
DataObject property value. For example, by default, a VARCHAR column will be 
represented as a   String in its corresponding
+  * DataObject property. A user could insert a converter that transforms the 
the VARCHAR value to an Integer. If this is done then although the column
+  * returns character data, the DataObject property will be an Integer
+  * 
+  * 
+  */
+ public interface Converter {
+ 
+     /**
+      * Transform the columnData object to a new value and possibly new type. 
This should be the invers operation of #getColumnValue
+      * 
+      * @param columnData
+      *            The column value to transorm
+      * @return Returns the transformed value
+      */
+     Object getPropertyValue(Object columnData);
+ 
+     /**
+      * Transform the columnData object to a new value and possibly new type. 
This should be the invers operation of #getPropertyValue
+      * 
+      * @param propertyData
+      *            The property value to transform
+      * @return Returns the transformed value
+      */
+     Object getColumnValue(Object propertyData);
+ 
+ }
+ 
+ }}}
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to