Class DateType.DateFormat

java.lang.Object
org.simpleframework.xml.transform.DateType.DateFormat
Enclosing class:
DateType

private static class DateType.DateFormat extends 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 Details

    • format

      private SimpleDateFormat format
      This is the simple date format used to parse the string.
  • Constructor Details

    • DateFormat

      public DateFormat(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 Details

    • getText

      public String getText(Date date) throws 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:
      Exception
    • getDate

      public Date getDate(String text) throws 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:
      Exception