Class XMLDateTime

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<XMLDateTime>

    public final class XMLDateTime
    extends java.lang.Object
    implements java.lang.Cloneable, java.lang.Comparable<XMLDateTime>
    This class provides utility functions for comparisons operating on xml:dateTime datatypes as specified in W3C, XML Schema Part 2: Datatypes Second Edition Known deviations from the standard: - the range of years in this implementation is limited to Integer.MIN_VALUE to Integer.MAX_VALUE for practical reasons - this implementation accepts some dates that have impossible month, day-of-month combinations (such as 2005-02-29, which was not a leap year)
    Since:
    1.0
    Version:
    1.0
    Author:
    Arjohn Kampman, Michael Grove
    • Constructor Summary

      Constructors 
      Constructor Description
      XMLDateTime​(java.lang.String theDateTime)
      Creates a new DateTime 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 theDateTime)
      Compares this DateTime object to another DateTime object.
      boolean isNormalized()
      Checks whether this object has already been normalized.
      void normalize()
      Normalizes this dateTime object.
      java.lang.String toString()
      Returns the xsd:dateTime string-representation of this object.
      • Methods inherited from class java.lang.Object

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

      • XMLDateTime

        public XMLDateTime​(@Nonnull
                           java.lang.String theDateTime)
        Creates a new DateTime object for the supplied xsd:dateTime string value.
        Parameters:
        theDateTime - An xsd:dateTime value, for example 1999-05-31T13:20:00-05:00.
    • Method Detail

      • isNormalized

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

        public void normalize()
        Normalizes this dateTime object.
      • 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​(@Nonnull
                             XMLDateTime theDateTime)
        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