ca.sqlpower.wabit.dao.session
Interface BidirectionalConverter<S,C>

All Known Implementing Classes:
ColorConverter, ContainerConverter, CubeConverter, EnumConverter, FontConverter, FormatConverter, ItemConverter, JDBCDataSourceConverter, Olap4JAxisConverter, Olap4jDataSourceConverter, PNGImageConverter, Point2DConverter, SPObjectConverter, SQLJoinConverter

public interface BidirectionalConverter<S,C>

This interface allows conversions of one type of object to another and back again. The types of object that this can convert are defined by S for the simple type of object and C for the complex type of object.


Field Summary
static java.lang.String DELIMITER
          This is a String delimiter that separates the properties of an object.
 
Method Summary
 C convertToComplexType(S convertFrom)
          Converts an object of type S to an object of type C.
 S convertToSimpleType(C convertFrom, java.lang.Object... additionalInfo)
          This method converts an object of type C to an object of type S.
 

Field Detail

DELIMITER

static final java.lang.String DELIMITER
This is a String delimiter that separates the properties of an object.

See Also:
Constant Field Values
Method Detail

convertToSimpleType

S convertToSimpleType(C convertFrom,
                      java.lang.Object... additionalInfo)
This method converts an object of type C to an object of type S.

Parameters:
convertFrom - The object to convert.
additionalInfo - 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.

convertToComplexType

C convertToComplexType(S convertFrom)
                       throws org.apache.commons.beanutils.ConversionException
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.

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.


Copyright © 2009. All Rights Reserved.