Class AbstractXmlDateTypeHandler

    • Field Detail

      • dataTypeFactory

        protected static final javax.xml.datatype.DatatypeFactory dataTypeFactory
    • Constructor Detail

      • AbstractXmlDateTypeHandler

        public AbstractXmlDateTypeHandler()
    • Method Detail

      • parse

        public java.util.Date parse​(java.lang.String text)
                             throws TypeConversionException
        Description copied from interface: TypeHandler
        Parses field text into a Java object.
        Specified by:
        parse in interface TypeHandler
        Overrides:
        parse in class DateTypeHandler
        Parameters:
        text - the field text to parse, which may be null if the field was not passed in the record
        Returns:
        the parsed Java object
        Throws:
        TypeConversionException - if the text cannot be parsed
      • format

        public abstract java.lang.String format​(java.lang.Object value)
        Description copied from interface: TypeHandler
        Formats a Java object into field text.
        Specified by:
        format in interface TypeHandler
        Overrides:
        format in class DateTypeHandler
        Parameters:
        value - the Java object to format, which may be null
        Returns:
        the formatted field text, or null to indicate the value is not present, or TypeHandler.NIL for XML formatted streams
      • getDatatypeQName

        protected abstract javax.xml.namespace.QName getDatatypeQName()
        Returns the expected XML Schema data type when parse is called.
        Returns:
        the expected XML schema data type QName
      • newCalendar

        protected java.util.Calendar newCalendar()
        Creates a new calendar using the configured time zone (if set).
        Returns:
        a new Calendar instance
      • getTimeZoneOffset

        protected int getTimeZoneOffset​(java.util.Date date)
        Returns the time zone offset in minutes for the given date, or DatatypeConstants.FIELD_UNDEFINED if a time zone was not configured.
        Parameters:
        date - the date on which to determine the time zone offset
        Returns:
        the time zone offset in minutes, or DatatypeConstants.FIELD_UNDEFINED
      • isTimeZoneAllowed

        public boolean isTimeZoneAllowed()
        Returns whether time zone information is allowed when parsing field text. Defaults to true.
        Returns:
        true if time zone information is allowed when parsing field text
      • setTimeZoneAllowed

        public void setTimeZoneAllowed​(boolean timeZoneAllowed)
        Sets whether time zone information is allowed when parsing field text. Defaults to true.
        Parameters:
        timeZoneAllowed - true if time zone information is allowed when parsing field text
      • isLenientDatatype

        public boolean isLenientDatatype()
        Returns whether data type validation is skipped when parsing field text. Set to false by default, a TypeConversionException is thrown when a XML dateTime type handler is used to parse a XML date or XML time, or a XML date handler is used to parse a XML dateTime field, etc.
        Returns:
        true if data type validation is skipped
      • setLenientDatatype

        public void setLenientDatatype​(boolean lenientDatatype)
        Sets whether data type validation is skipped when parsing field text. Set to false by default, a TypeConversionException is thrown when a XML dateTime type handler is used to parse a XML date or XML time, or a XML date handler is used to parse a XML dateTime field, etc.
        Parameters:
        lenientDatatype - true if data type validation is skipped