butler.ext.code
Class CodeDatatype

java.lang.Object
  extended by butler.sql.metadata.DefaultDatatype
      extended by butler.ext.code.CodeDatatype
All Implemented Interfaces:
Datatype
Direct Known Subclasses:
MonthDatatype, TimeUnitDatatype, WeekdayDatatype

public class CodeDatatype
extends DefaultDatatype

Author:
Fredrik Bertilsson

Constructor Summary
CodeDatatype(int type)
           
CodeDatatype(int type, int size)
           
 
Method Summary
 void add(Code obj)
           
 void addDescription(Code code, java.util.Locale locale, java.lang.String desc)
           
 java.lang.Object db2obj(java.lang.Object dbValue)
          Converts from database format to java object format.
 java.lang.String getDescription(Code value)
           
 java.text.Format getFormat()
          Returns Format instance.
 java.util.List getOperators()
          Returns the operators that have meaning on this datatype.
 java.util.List getValues()
           
 java.lang.Object obj2db(java.lang.Object value)
          Converts from java object format to database format.
 java.lang.Object xml2obj(java.lang.String str)
          Converts from xml string format to java object format.
 
Methods inherited from class butler.sql.metadata.DefaultDatatype
getDatatype, getDecimalDigits, getInstance, getJavaClass, getMaskFormatter, getSize, getType, obj2xml, parse, toXML, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeDatatype

public CodeDatatype(int type,
                    int size)

CodeDatatype

public CodeDatatype(int type)
Method Detail

add

public void add(Code obj)
         throws java.lang.Exception
Throws:
java.lang.Exception

addDescription

public void addDescription(Code code,
                           java.util.Locale locale,
                           java.lang.String desc)

getDescription

public java.lang.String getDescription(Code value)
                                throws java.lang.Exception
Throws:
java.lang.Exception

getValues

public java.util.List getValues()

getOperators

public java.util.List getOperators()
                            throws java.lang.Exception
Description copied from interface: Datatype
Returns the operators that have meaning on this datatype. The first operator in the list (at index 0) will be the chosen operator if no other is actively chosen.

Specified by:
getOperators in interface Datatype
Overrides:
getOperators in class DefaultDatatype
Throws:
java.lang.Exception

obj2db

public java.lang.Object obj2db(java.lang.Object value)
                        throws java.lang.Exception
Description copied from interface: Datatype
Converts from java object format to database format.

Specified by:
obj2db in interface Datatype
Overrides:
obj2db in class DefaultDatatype
Throws:
java.lang.Exception

db2obj

public java.lang.Object db2obj(java.lang.Object dbValue)
                        throws java.lang.Exception
Description copied from interface: Datatype
Converts from database format to java object format.

Specified by:
db2obj in interface Datatype
Overrides:
db2obj in class DefaultDatatype
Throws:
java.lang.Exception

xml2obj

public java.lang.Object xml2obj(java.lang.String str)
Description copied from interface: Datatype
Converts from xml string format to java object format.

Specified by:
xml2obj in interface Datatype
Overrides:
xml2obj in class DefaultDatatype

getFormat

public java.text.Format getFormat()
Description copied from interface: Datatype
Returns Format instance.

Specified by:
getFormat in interface Datatype
Overrides:
getFormat in class DefaultDatatype