org.kuali.kfs.sys.dataaccess
Class OjbCharBooleanFieldInverseConversion

java.lang.Object
  extended by org.kuali.kfs.sys.dataaccess.OjbCharBooleanFieldInverseConversion
All Implemented Interfaces:
Serializable, org.apache.ojb.broker.accesslayer.conversions.FieldConversion

public class OjbCharBooleanFieldInverseConversion
extends Object
implements org.apache.ojb.broker.accesslayer.conversions.FieldConversion

This class is intended to be used for inverting all the boolean values stored in the database before loading them into the business object and vice versa. This functionality is necessary for situations where a database table stores the opposite of the intented boolean attribute. An example is where a given business object has a pre-defined attribute, such as "inactive", while the user wishes to display the value as an 'active' indicator rather than an 'inactive indicator. Ideally, it would be better to replace the field in the database with the appropriate representation of the data so we do not have to perform these confusing conversions on data. Unfortunately, this is not always an option.

See Also:
Serialized Form

Constructor Summary
OjbCharBooleanFieldInverseConversion()
           
 
Method Summary
 Object javaToSql(Object source)
          This method takes the value intended to be passed to the SQL statement and replaces that value with its inverse.
 Object sqlToJava(Object source)
          This method takes the value returned from the database and replaces it with its inverse, thus FALSE becomes TRUE and vice versa.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OjbCharBooleanFieldInverseConversion

public OjbCharBooleanFieldInverseConversion()
Method Detail

javaToSql

public Object javaToSql(Object source)
This method takes the value intended to be passed to the SQL statement and replaces that value with its inverse. Thus TRUE becomes FALSE and vice versa.

Specified by:
javaToSql in interface org.apache.ojb.broker.accesslayer.conversions.FieldConversion
See Also:
FieldConversion.javaToSql(java.lang.Object)

sqlToJava

public Object sqlToJava(Object source)
This method takes the value returned from the database and replaces it with its inverse, thus FALSE becomes TRUE and vice versa.

Specified by:
sqlToJava in interface org.apache.ojb.broker.accesslayer.conversions.FieldConversion
See Also:
FieldConversion.sqlToJava(java.lang.Object)


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.