org.tockit.datatype.xsd
Class DecimalType

java.lang.Object
  extended byorg.tockit.datatype.AbstractDatatype
      extended byorg.tockit.datatype.xsd.AbstractXSDDatatype
          extended byorg.tockit.datatype.xsd.DecimalType
All Implemented Interfaces:
Datatype, XMLizable

public class DecimalType
extends AbstractXSDDatatype

To do:
we lack support for the general decimal type without restriction

Nested Class Summary
 
Nested classes inherited from class org.tockit.datatype.xsd.AbstractXSDDatatype
AbstractXSDDatatype.TypeCreator
 
Field Summary
 
Fields inherited from class org.tockit.datatype.xsd.AbstractXSDDatatype
XSD_NAMESPACE
 
Method Summary
protected  void addRestrictions(org.jdom.Element restrictionElement)
           
 boolean canConvertFrom(Value value)
           
 boolean canParse(java.lang.String text)
           
 Value convertType(Value value)
           
static DecimalType createDecimalType(java.lang.String name, double min, boolean minIncluded, double max, boolean maxIncluded, int numDecimals)
           
static DecimalType createDecimalType(java.lang.String name, java.lang.Double min, boolean minIncluded, java.lang.Double max, boolean maxIncluded, java.lang.Integer numDecimals)
           
static DecimalType createDecimalType(java.lang.String name, double min, double max, int numDecimals)
           
static DecimalType createUnrestrictedType(java.lang.String name)
           
protected  java.lang.String getBaseType()
           
static DatatypeFactory.TypeCreator getTypeCreator()
           
 void insertValue(org.jdom.Element element, Value value)
          Adds the given value into the element.
 boolean isValidValue(double value)
           
 boolean isValidValue(Value valueToTest)
           
 Value parse(java.lang.String text)
           
 void readXML(org.jdom.Element elem)
          Read this element as the content of elem.
 Value toValue(org.jdom.Element element)
           
 
Methods inherited from class org.tockit.datatype.xsd.AbstractXSDDatatype
createElement, registerTypeCreators, toXML
 
Methods inherited from class org.tockit.datatype.AbstractDatatype
getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTypeCreator

public static DatatypeFactory.TypeCreator getTypeCreator()

createDecimalType

public static DecimalType createDecimalType(java.lang.String name,
                                            double min,
                                            double max,
                                            int numDecimals)

createDecimalType

public static DecimalType createDecimalType(java.lang.String name,
                                            double min,
                                            boolean minIncluded,
                                            double max,
                                            boolean maxIncluded,
                                            int numDecimals)

createUnrestrictedType

public static DecimalType createUnrestrictedType(java.lang.String name)

createDecimalType

public static DecimalType createDecimalType(java.lang.String name,
                                            java.lang.Double min,
                                            boolean minIncluded,
                                            java.lang.Double max,
                                            boolean maxIncluded,
                                            java.lang.Integer numDecimals)

isValidValue

public boolean isValidValue(Value valueToTest)

isValidValue

public boolean isValidValue(double value)

canConvertFrom

public boolean canConvertFrom(Value value)
Specified by:
canConvertFrom in interface Datatype
Overrides:
canConvertFrom in class AbstractDatatype

convertType

public Value convertType(Value value)
                  throws ConversionException
Specified by:
convertType in interface Datatype
Overrides:
convertType in class AbstractDatatype
Throws:
ConversionException

canParse

public boolean canParse(java.lang.String text)
Specified by:
canParse in interface Datatype
Overrides:
canParse in class AbstractDatatype

parse

public Value parse(java.lang.String text)
            throws ConversionException
Specified by:
parse in interface Datatype
Overrides:
parse in class AbstractDatatype
Throws:
ConversionException

toValue

public Value toValue(org.jdom.Element element)

insertValue

public void insertValue(org.jdom.Element element,
                        Value value)
Description copied from interface: Datatype
Adds the given value into the element. This can be done either by adding a "value" attribute or by adding content. Both are in the default namespace, but which way is used depends on the actual type implementation.


readXML

public void readXML(org.jdom.Element elem)
             throws XMLSyntaxError
Description copied from interface: XMLizable
Read this element as the content of elem.

Throws:
XMLSyntaxError

getBaseType

protected java.lang.String getBaseType()
Specified by:
getBaseType in class AbstractXSDDatatype

addRestrictions

protected void addRestrictions(org.jdom.Element restrictionElement)
Specified by:
addRestrictions in class AbstractXSDDatatype


The ToscanaJ project