butler.sql.metadata
Class DefaultDatatype

java.lang.Object
  extended by butler.sql.metadata.DefaultDatatype
All Implemented Interfaces:
Datatype
Direct Known Subclasses:
BlobDatatype, BooleanDatatype, CodeDatatype, DateDatatype, EnumDatatype, IntervalDatatype, StringDatatype, TimeOfDayDatatype

public class DefaultDatatype
extends java.lang.Object
implements Datatype

Author:
Fredrik Bertilsson

Constructor Summary
DefaultDatatype()
           
DefaultDatatype(Column col)
          Deprecated. Not in use
DefaultDatatype(int type, int size, int decimals)
           
 
Method Summary
 java.lang.Object db2obj(java.lang.Object obj)
          Converts from database format to java object format.
 Datatype getDatatype(Operator op)
          Returns a specific datatype that should be used with the given operator.
 int getDecimalDigits()
           
 java.text.Format getFormat()
          Returns Format instance.
static Datatype getInstance()
           
 java.lang.Class getJavaClass()
          Returns the java class that is used for this datatype.
 javax.swing.text.MaskFormatter getMaskFormatter()
          Deprecated. Not in use
 java.util.List getOperators()
          Returns the operators that have meaning on this datatype.
 int getSize()
           
 int getType()
           
 java.lang.Object obj2db(java.lang.Object obj)
          Converts from java object format to database format.
 java.lang.String obj2xml(java.lang.Object obj)
          Converts from java object format to xml string format.
static Datatype parse(org.dom4j.Element element)
           
 void toXML(org.xml.sax.ContentHandler handler)
          Builds an xml representation of this object.
 void validate(java.lang.Object value)
          Validated column value.
 java.lang.Object xml2obj(java.lang.String xml)
          Converts from xml string format to java object format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDatatype

public DefaultDatatype()

DefaultDatatype

public DefaultDatatype(Column col)
Deprecated. Not in use


DefaultDatatype

public DefaultDatatype(int type,
                       int size,
                       int decimals)
Method Detail

getInstance

public static Datatype getInstance()

getFormat

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

Specified by:
getFormat in interface Datatype
Throws:
java.lang.Exception

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
Throws:
java.lang.Exception

getMaskFormatter

public javax.swing.text.MaskFormatter getMaskFormatter()
                                                throws java.lang.Exception
Deprecated. Not in use

Throws:
java.lang.Exception

validate

public void validate(java.lang.Object value)
              throws java.lang.Exception
Description copied from interface: Datatype
Validated column value. If the value is invalid, an IllegalArgumentException should be thrown.

Specified by:
validate in interface Datatype
Throws:
java.lang.Exception

xml2obj

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

Specified by:
xml2obj in interface Datatype
Throws:
java.lang.Exception

obj2xml

public java.lang.String obj2xml(java.lang.Object obj)
                         throws java.lang.Exception
Description copied from interface: Datatype
Converts from java object format to xml string format.

Specified by:
obj2xml in interface Datatype
Throws:
java.lang.Exception

obj2db

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

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

db2obj

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

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

getJavaClass

public java.lang.Class getJavaClass()
                             throws java.lang.Exception
Description copied from interface: Datatype
Returns the java class that is used for this datatype.

Specified by:
getJavaClass in interface Datatype
Throws:
java.lang.Exception

parse

public static Datatype parse(org.dom4j.Element element)
                      throws java.lang.Exception
Throws:
java.lang.Exception

toXML

public void toXML(org.xml.sax.ContentHandler handler)
           throws java.lang.Exception
Description copied from interface: Datatype
Builds an xml representation of this object.

Specified by:
toXML in interface Datatype
Throws:
java.lang.Exception

getType

public int getType()
            throws java.lang.Exception
Specified by:
getType in interface Datatype
Throws:
java.lang.Exception

getSize

public int getSize()
            throws java.lang.Exception
Specified by:
getSize in interface Datatype
Throws:
java.lang.Exception

getDecimalDigits

public int getDecimalDigits()
                     throws java.lang.Exception
Specified by:
getDecimalDigits in interface Datatype
Throws:
java.lang.Exception

getDatatype

public Datatype getDatatype(Operator op)
Description copied from interface: Datatype
Returns a specific datatype that should be used with the given operator. For example LikeDatatype or CompareDatatype

Specified by:
getDatatype in interface Datatype