ca.sqlpower.wabit.dao.session
Class SPObjectConverter

java.lang.Object
  extended by ca.sqlpower.wabit.dao.session.SPObjectConverter
All Implemented Interfaces:
BidirectionalConverter<java.lang.String,ca.sqlpower.object.SPObject>

public class SPObjectConverter
extends java.lang.Object
implements BidirectionalConverter<java.lang.String,ca.sqlpower.object.SPObject>

Converts WabitObjects to a unique string per wabit object and converts these strings into WabitObjects that are contained in the root.


Field Summary
 
Fields inherited from interface ca.sqlpower.wabit.dao.session.BidirectionalConverter
DELIMITER
 
Constructor Summary
SPObjectConverter(ca.sqlpower.object.SPObject root)
           
 
Method Summary
 ca.sqlpower.object.SPObject convertToComplexType(java.lang.String convertFrom)
          Converts an object of type S to an object of type C.
 java.lang.String convertToSimpleType(ca.sqlpower.object.SPObject convertFrom, java.lang.Object... additionalValues)
          This method converts an object of type C to an object of type S.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPObjectConverter

public SPObjectConverter(ca.sqlpower.object.SPObject root)
Method Detail

convertToComplexType

public ca.sqlpower.object.SPObject convertToComplexType(java.lang.String convertFrom)
                                                 throws org.apache.commons.beanutils.ConversionException
Description copied from interface: BidirectionalConverter
Converts an object of type S to an object of type C. The given object we are converting from must contain a valid representation of the object or else an IllegalArgumentException will be thrown.

Specified by:
convertToComplexType in interface BidirectionalConverter<java.lang.String,ca.sqlpower.object.SPObject>
Parameters:
convertFrom - The object to convert.
Returns:
The complex type representation of the object.
Throws:
org.apache.commons.beanutils.ConversionException - Thrown if the object could not be converted to a complex type even though the simple type is a correct representation.

convertToSimpleType

public java.lang.String convertToSimpleType(ca.sqlpower.object.SPObject convertFrom,
                                            java.lang.Object... additionalValues)
Description copied from interface: BidirectionalConverter
This method converts an object of type C to an object of type S.

Specified by:
convertToSimpleType in interface BidirectionalConverter<java.lang.String,ca.sqlpower.object.SPObject>
Parameters:
convertFrom - The object to convert.
additionalValues - Some types of object require some kind of additional information to be properly persisted which is passed through here. One specific place is when converting Cubes to get their data source. There is probably a better way of doing this.
Returns:
The simple type representation of the object.


Copyright © 2009. All Rights Reserved.