butler.sql.metadata
Class NumericDatatype

java.lang.Object
  extended by butler.sql.metadata.DefaultDatatype
      extended by butler.sql.metadata.StringDatatype
          extended by butler.sql.metadata.NumericDatatype
All Implemented Interfaces:
Datatype
Direct Known Subclasses:
DurationDatatype, MoneyDatatype

public class NumericDatatype
extends StringDatatype

Author:
Fredrik Bertilsson

Nested Class Summary
 
Nested classes/interfaces inherited from class butler.sql.metadata.StringDatatype
StringDatatype.StringLikeDatatype
 
Field Summary
 
Fields inherited from class butler.sql.metadata.StringDatatype
_maxLength, _minLength, _partialRegex, _regex
 
Constructor Summary
NumericDatatype(int type, int size, int decimalDigits)
           
NumericDatatype(int type, int size, int decimalDigits, java.text.DecimalFormat format)
           
 
Method Summary
 java.lang.Object db2obj(java.lang.Object obj)
          Converts from database format to java object format.
 int getDecimalDigits()
           
 java.text.Format getFormat()
          Returns Format instance.
 java.lang.Class getJavaClass()
          Returns the java class that is used for this datatype.
 int getMaxLength()
           
 java.lang.String getPartialRegex()
           
 java.lang.String getRegex()
           
 int getSize()
           
 int getType()
           
 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 butler.sql.metadata.StringDatatype
format, getDatatype, getLikeDatatype, getMinLength, isTrim, isTruncate, obj2db, parseStringDatatype, setTrim, setTruncate, toXML
 
Methods inherited from class butler.sql.metadata.DefaultDatatype
getInstance, getMaskFormatter, getOperators, obj2xml, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumericDatatype

public NumericDatatype(int type,
                       int size,
                       int decimalDigits)
                throws java.lang.Exception
Throws:
java.lang.Exception

NumericDatatype

public NumericDatatype(int type,
                       int size,
                       int decimalDigits,
                       java.text.DecimalFormat format)
                throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

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
Overrides:
xml2obj in class StringDatatype
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
Overrides:
db2obj in class StringDatatype
Throws:
java.lang.Exception

getMaxLength

public int getMaxLength()
Overrides:
getMaxLength in class StringDatatype

getRegex

public java.lang.String getRegex()
Overrides:
getRegex in class StringDatatype

getPartialRegex

public java.lang.String getPartialRegex()
Overrides:
getPartialRegex in class StringDatatype

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
Overrides:
validate in class StringDatatype
Throws:
java.lang.Exception

getFormat

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

Specified by:
getFormat in interface Datatype
Overrides:
getFormat in class DefaultDatatype
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
Overrides:
getJavaClass in class StringDatatype
Throws:
java.lang.Exception

getType

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

getSize

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

getDecimalDigits

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