Class UtcDateTimeAdapter

java.lang.Object
javax.xml.bind.annotation.adapters.XmlAdapter<String,org.joda.time.DateTime>
google.registry.xml.UtcDateTimeAdapter

public class UtcDateTimeAdapter extends javax.xml.bind.annotation.adapters.XmlAdapter<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.

  • Constructor Details

    • UtcDateTimeAdapter

      public UtcDateTimeAdapter()
  • Method Details

    • getFormattedString

      public static 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 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<String,org.joda.time.DateTime>
    • marshal

      public 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<String,org.joda.time.DateTime>