Package google.registry.xml
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
-
Method Summary
Modifier and TypeMethodDescriptionmarshal
(org.joda.time.LocalDate date) ConvertsLocalDate
to UTC and returns it as an RFC3339 string.org.joda.time.LocalDate
Parses an ISO timestamp string into a UTCLocalDate
object, converting timezones and truncating time to midnight if necessary.
-
Constructor Details
-
DateAdapter
public DateAdapter()
-
-
Method Details
-
unmarshal
Parses an ISO timestamp string into a UTCLocalDate
object, converting timezones and truncating time to midnight if necessary. Iftimestamp
is empty ornull
thennull
is returned.- Specified by:
unmarshal
in classjakarta.xml.bind.annotation.adapters.XmlAdapter<String,
org.joda.time.LocalDate>
-
marshal
ConvertsLocalDate
to UTC and returns it as an RFC3339 string. Iftimestamp
isnull
then an empty string is returned.- Specified by:
marshal
in classjakarta.xml.bind.annotation.adapters.XmlAdapter<String,
org.joda.time.LocalDate>
-