Class UtcDateTimeAdapter


  • public class UtcDateTimeAdapter
    extends javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,​org.joda.time.DateTime>
    Adapter to use Joda DateTime when marshalling XML timestamps.

    These fields shall contain timestamps indicating the date and time in UTC as specified in RFC3339, with no offset from the zero meridian. For example: 2010-10-17T00:00:00Z.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getFormattedString​(org.joda.time.DateTime timestamp)
      Same as marshal(DateTime), but in a convenient static format.
      java.lang.String marshal​(org.joda.time.DateTime timestamp)
      Converts DateTime to UTC and returns it as an RFC3339 string.
      org.joda.time.DateTime unmarshal​(java.lang.String timestamp)
      Parses an ISO timestamp string into a UTC DateTime object, converting timezones if necessary.
      • Methods inherited from class java.lang.Object

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

      • UtcDateTimeAdapter

        public UtcDateTimeAdapter()
    • Method Detail

      • getFormattedString

        public static java.lang.String getFormattedString​(@Nullable
                                                          org.joda.time.DateTime timestamp)
        Same as marshal(DateTime), but in a convenient static format.
      • unmarshal

        @Nullable
        @CheckForNull
        public org.joda.time.DateTime unmarshal​(@Nullable
                                                java.lang.String timestamp)
        Parses an ISO timestamp string into a UTC DateTime object, converting timezones if necessary. If timestamp is empty or null then null is returned.
        Specified by:
        unmarshal in class javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,​org.joda.time.DateTime>
      • marshal

        public java.lang.String marshal​(@Nullable
                                        org.joda.time.DateTime timestamp)
        Converts DateTime to UTC and returns it as an RFC3339 string. If timestamp is null then an empty string is returned.
        Specified by:
        marshal in class javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,​org.joda.time.DateTime>