Class DateAdapter

java.lang.Object
jakarta.xml.bind.annotation.adapters.XmlAdapter<String,org.joda.time.LocalDate>
google.registry.xml.DateAdapter

public class DateAdapter extends jakarta.xml.bind.annotation.adapters.XmlAdapter<String,org.joda.time.LocalDate>
Adapter to use Joda LocalDate when marshalling the XML Schema date type.

Dates are represented as midnight in UTC. The parser aims to be permissive in what it accepts. Timestamps are converted to UTC if a zone is specified and then the time section is truncated. This can lead to unexpected behavior, but it will be your fault.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    marshal(org.joda.time.LocalDate date)
    Converts LocalDate to UTC and returns it as an RFC3339 string.
    org.joda.time.LocalDate
    unmarshal(String timestamp)
    Parses an ISO timestamp string into a UTC LocalDate object, converting timezones and truncating time to midnight if necessary.

    Methods inherited from class java.lang.Object

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

    • DateAdapter

      public DateAdapter()
  • Method Details

    • unmarshal

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

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