org.tockit.datatype.xsd
Class StringType

java.lang.Object
  extended byorg.tockit.datatype.AbstractDatatype
      extended byorg.tockit.datatype.xsd.AbstractXSDDatatype
          extended byorg.tockit.datatype.xsd.StringType
All Implemented Interfaces:
Datatype, XMLizable
Direct Known Subclasses:
StringType.EnumerationRestrictedStringType, StringType.LengthRestrictedStringType, StringType.PatternRestrictedStringType

public class StringType
extends AbstractXSDDatatype

To do:
XSD allows combining the restrictions, we don't

Nested Class Summary
static class StringType.EnumerationRestrictedStringType
           
static class StringType.LengthRestrictedStringType
           
static class StringType.PatternRestrictedStringType
           
 
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
 
Constructor Summary
protected StringType(java.lang.String name)
           
 
Method Summary
protected  void addRestrictions(org.jdom.Element restrictionElement)
           
 boolean canConvertFrom(Value value)
           
 boolean canParse(java.lang.String text)
           
 Value convertType(Value value)
           
static StringType createEnumerationRestrictedType(java.lang.String name, java.lang.String[] enumeration)
           
static StringType createEnumerationRestrictedType(java.lang.String name, StringValue[] enumeration)
           
static StringType createLengthRestrictedType(java.lang.String name, int minLength, int maxLength)
           
static StringType createPatternRestrictedType(java.lang.String name, java.lang.String regExp)
           
static StringType 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.
protected  boolean isValidStringValue(java.lang.String valueToTest)
           
 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
 

Constructor Detail

StringType

protected StringType(java.lang.String name)
Method Detail

getTypeCreator

public static DatatypeFactory.TypeCreator getTypeCreator()

createUnrestrictedType

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

createLengthRestrictedType

public static StringType createLengthRestrictedType(java.lang.String name,
                                                    int minLength,
                                                    int maxLength)

createPatternRestrictedType

public static StringType createPatternRestrictedType(java.lang.String name,
                                                     java.lang.String regExp)

createEnumerationRestrictedType

public static StringType createEnumerationRestrictedType(java.lang.String name,
                                                         StringValue[] enumeration)

createEnumerationRestrictedType

public static StringType createEnumerationRestrictedType(java.lang.String name,
                                                         java.lang.String[] enumeration)

isValidValue

public boolean isValidValue(Value valueToTest)

isValidStringValue

protected boolean isValidStringValue(java.lang.String valueToTest)

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

addRestrictions

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

getBaseType

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


The ToscanaJ project