Class DatatypeHandler


  • public class DatatypeHandler
    extends java.lang.Object
    A class used for "guessing" the proper datatype of an XML attribute or an XML element with simpleContent.
    Version:
    $Revision: 6944 $ $Date: 2005-03-07 01:33:49 -0700 (Mon, 07 Mar 2005) $
    Author:
    Keith Visco
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BOOLEAN_TYPE
      The name of the XML Schema boolean type
      static java.lang.String DATE_TYPE
      The name of the XML Schema date type
      static java.lang.String DATETIME_TYPE
      The name of the XML Schema dateTime type
      static java.lang.String DOUBLE_TYPE
      The name of the XML Schema double type
      static java.lang.String FLOAT_TYPE
      The name of the XML Schema float type
      static java.lang.String INTEGER_TYPE
      The name of the XML Schema integer type
      static java.lang.String LONG_TYPE
      The name of the XML Schema long type
      static java.lang.String STRING_TYPE
      The name of the XML Schema string type
      static java.lang.String TIME_TYPE
      The name of the XML Schema time type
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String guessType​(java.lang.String value)
      Guesses the datatype for the given value.
      protected static java.lang.String whichType​(java.lang.String type1, java.lang.String type2)
      Guesses which datatype should be used.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BOOLEAN_TYPE

        public static final java.lang.String BOOLEAN_TYPE
        The name of the XML Schema boolean type
        See Also:
        Constant Field Values
      • DATE_TYPE

        public static final java.lang.String DATE_TYPE
        The name of the XML Schema date type
        See Also:
        Constant Field Values
      • DATETIME_TYPE

        public static final java.lang.String DATETIME_TYPE
        The name of the XML Schema dateTime type
        See Also:
        Constant Field Values
      • DOUBLE_TYPE

        public static final java.lang.String DOUBLE_TYPE
        The name of the XML Schema double type
        See Also:
        Constant Field Values
      • FLOAT_TYPE

        public static final java.lang.String FLOAT_TYPE
        The name of the XML Schema float type
        See Also:
        Constant Field Values
      • INTEGER_TYPE

        public static final java.lang.String INTEGER_TYPE
        The name of the XML Schema integer type
        See Also:
        Constant Field Values
      • LONG_TYPE

        public static final java.lang.String LONG_TYPE
        The name of the XML Schema long type
        See Also:
        Constant Field Values
      • STRING_TYPE

        public static final java.lang.String STRING_TYPE
        The name of the XML Schema string type
        See Also:
        Constant Field Values
      • TIME_TYPE

        public static final java.lang.String TIME_TYPE
        The name of the XML Schema time type
        See Also:
        Constant Field Values
    • Method Detail

      • guessType

        public static java.lang.String guessType​(java.lang.String value)
        Guesses the datatype for the given value. When the type cannot be determined, it simply defaults to DatatypeHandler.STRING_TYPE.
        Note: This may be a slow process.
        Parameters:
        value - the value to determine the type for
        Returns:
        the type that the value may be
      • whichType

        protected static java.lang.String whichType​(java.lang.String type1,
                                                    java.lang.String type2)
        Guesses which datatype should be used.