Class DateType.DateFormat

  • Enclosing class:
    DateType

    private static class DateType.DateFormat
    extends java.lang.Object
    The DateFormat provides a synchronized means for using the simple date format object. It ensures that should there be many threads trying to gain access to the formatter that they will not collide causing a race condition.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.text.SimpleDateFormat format
      This is the simple date format used to parse the string.
    • Constructor Summary

      Constructors 
      Constructor Description
      DateFormat​(java.lang.String format)
      Constructor for the DateFormat object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Date getDate​(java.lang.String text)
      This is used to provide a transformation from a string to a date.
      java.lang.String getText​(java.util.Date date)
      This is used to provide a transformation from a date to a string.
      • Methods inherited from class java.lang.Object

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

      • format

        private java.text.SimpleDateFormat format
        This is the simple date format used to parse the string.
    • Constructor Detail

      • DateFormat

        public DateFormat​(java.lang.String format)
        Constructor for the DateFormat object. This will wrap a simple date format, providing access to the conversion functions which allow date to string and string to date.
        Parameters:
        format - this is the pattern to use for the date type
    • Method Detail

      • getText

        public java.lang.String getText​(java.util.Date date)
                                 throws java.lang.Exception
        This is used to provide a transformation from a date to a string. It ensures that there is a bidirectional transformation process which allows dates to be serialized and deserialized with XML.
        Parameters:
        date - this is the date to be converted to a string value
        Returns:
        returns the string that has be converted from a date
        Throws:
        java.lang.Exception
      • getDate

        public java.util.Date getDate​(java.lang.String text)
                               throws java.lang.Exception
        This is used to provide a transformation from a string to a date. It ensures that there is a bidirectional transformation process which allows dates to be serialized and deserialized with XML.
        Parameters:
        text - this is the string to be converted to a date value
        Returns:
        returns the date that has be converted from a string
        Throws:
        java.lang.Exception