Class XMLDateTime

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String dateTimeString
      The raw dateTime string that was used to initialize this object.
      private java.lang.String days
      day part of the dateTime object as String
      private java.lang.String fractionalSeconds
      fractional seconds part of the dateTime object as String
      private java.lang.String hours
      hour part of the dateTime object as String
      private java.lang.String hoursTimezone
      hours part of the optional timezone as String
      private int iDays
      day part of the dateTime object as int
      private double iFractionalSeconds
      fractional seconds part of the dateTime object as int
      private int iHours
      hour part of the dateTime object as int
      private int iHoursTimezone
      hours part of the optional timezone as int
      private int iMinutes
      minute part of the dateTime object as int
      private int iMinutesTimezone
      minutes part of the optional timezone as int
      private int iMonths
      month part of the dateTime object as int
      private int iSeconds
      second part of the dateTime object as int
      private boolean isNegativeTimezone
      Flag indicating whether the timezone, if any, is positive or negative.
      private boolean isNegativeYear
      Flag indicating whether the year is positive or negative.
      private boolean isNormalized
      Flag indicating whether the values have been normalized.
      private int iYear
      year part of the dateTime object as int
      private java.lang.String minutes
      minutes part of the dateTime object as String
      private java.lang.String minutesTimezone
      minutes part of the optional timezone as String
      private java.lang.String months
      month part of the dateTime object as String
      private java.lang.String seconds
      seconds part of the dateTime object as String
      private java.lang.String year
      year part of the dateTime object as String
    • Constructor Summary

      Constructors 
      Constructor Description
      XMLDateTime​(java.lang.String dateTimeString)
      Creates a new XMLDateTime object for the supplied xsd:dateTime string value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()  
      int compareTo​(XMLDateTime otherDT)
      Compares this DateTime object to another DateTime object.
      private java.lang.String int2string​(int iValue, int minDigits)
      Converts an integer to a string, enforcing the resulting string to have at least minDigits digits by prepending zeros if it has less than that amount of digits.
      private boolean is30DayMonth​(int month)
      Checks if the supplied month is a month with exactly 30 days.
      private boolean isLeapYear​(int year)
      Checks if the supplied year is a leap year (one in which February 29 occurs) according to the definition in the XML Schema XSD definition
      boolean isNormalized()
      Checks whether this object has already been normalized.
      void normalize()
      Normalizes this dateTime object.
      private void parseDateTimeString()  
      private void setNumericFields()  
      java.lang.String toString()
      Returns the xsd:dateTime string-representation of this object.
      private void validateFieldValues()  
      private void verifyTokenValue​(java.lang.String token, java.lang.String expected, java.lang.String errMsg)  
      • Methods inherited from class java.lang.Object

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

      • dateTimeString

        private final java.lang.String dateTimeString
        The raw dateTime string that was used to initialize this object.
      • isNegativeYear

        private boolean isNegativeYear
        Flag indicating whether the year is positive or negative.
      • year

        private java.lang.String year
        year part of the dateTime object as String
      • months

        private java.lang.String months
        month part of the dateTime object as String
      • days

        private java.lang.String days
        day part of the dateTime object as String
      • hours

        private java.lang.String hours
        hour part of the dateTime object as String
      • minutes

        private java.lang.String minutes
        minutes part of the dateTime object as String
      • seconds

        private java.lang.String seconds
        seconds part of the dateTime object as String
      • fractionalSeconds

        private java.lang.String fractionalSeconds
        fractional seconds part of the dateTime object as String
      • isNegativeTimezone

        private boolean isNegativeTimezone
        Flag indicating whether the timezone, if any, is positive or negative.
      • hoursTimezone

        private java.lang.String hoursTimezone
        hours part of the optional timezone as String
      • minutesTimezone

        private java.lang.String minutesTimezone
        minutes part of the optional timezone as String
      • iYear

        private int iYear
        year part of the dateTime object as int
      • iMonths

        private int iMonths
        month part of the dateTime object as int
      • iDays

        private int iDays
        day part of the dateTime object as int
      • iHours

        private int iHours
        hour part of the dateTime object as int
      • iMinutes

        private int iMinutes
        minute part of the dateTime object as int
      • iSeconds

        private int iSeconds
        second part of the dateTime object as int
      • iFractionalSeconds

        private double iFractionalSeconds
        fractional seconds part of the dateTime object as int
      • iHoursTimezone

        private int iHoursTimezone
        hours part of the optional timezone as int
      • iMinutesTimezone

        private int iMinutesTimezone
        minutes part of the optional timezone as int
      • isNormalized

        private boolean isNormalized
        Flag indicating whether the values have been normalized.
    • Constructor Detail

      • XMLDateTime

        public XMLDateTime​(java.lang.String dateTimeString)
        Creates a new XMLDateTime object for the supplied xsd:dateTime string value.
        Parameters:
        dateTimeString - An xsd:dateTime lexical value, for example 1999-05-31T13:20:00-05:00.
        Throws:
        java.lang.IllegalArgumentException - if the supplied lexical value does not constitute a valid xsd:dateTime.
    • Method Detail

      • parseDateTimeString

        private void parseDateTimeString()
      • verifyTokenValue

        private void verifyTokenValue​(java.lang.String token,
                                      java.lang.String expected,
                                      java.lang.String errMsg)
      • setNumericFields

        private void setNumericFields()
      • validateFieldValues

        private void validateFieldValues()
      • is30DayMonth

        private boolean is30DayMonth​(int month)
        Checks if the supplied month is a month with exactly 30 days.
        Parameters:
        month - the month
        Returns:
        true iff the supplied month has exactly 30 days.
      • isLeapYear

        private boolean isLeapYear​(int year)
        Checks if the supplied year is a leap year (one in which February 29 occurs) according to the definition in the XML Schema XSD definition
        Parameters:
        year - the year.
        Returns:
        true if the supplied year is a leap year according to the XSD definition.
      • isNormalized

        public boolean isNormalized()
        Checks whether this object has already been normalized.
      • normalize

        public void normalize()
        Normalizes this dateTime object.
      • int2string

        private java.lang.String int2string​(int iValue,
                                            int minDigits)
        Converts an integer to a string, enforcing the resulting string to have at least minDigits digits by prepending zeros if it has less than that amount of digits.
      • toString

        public java.lang.String toString()
        Returns the xsd:dateTime string-representation of this object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        An xsd:dateTime value, e.g. 1999-05-31T13:20:00-05:00.
      • compareTo

        public int compareTo​(XMLDateTime otherDT)
        Compares this DateTime object to another DateTime object.
        Specified by:
        compareTo in interface java.lang.Comparable<XMLDateTime>
        Throws:
        java.lang.ClassCastException - If other is not a DateTime object.
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object