Class UniversalTimeAdapter

java.lang.Object
javax.xml.bind.annotation.adapters.XmlAdapter<XMLGregorianCalendar,Date>
org.apache.sis.internal.jaxb.gml.UniversalTimeAdapter

public final class UniversalTimeAdapter extends XmlAdapter<XMLGregorianCalendar,Date>
JAXB adapter wrapping the date value (as milliseconds elapsed since January 1st, 1970) in a XMLGregorianCalendar for the xs:dateTime type with the timezone forced to UTC. The milliseconds are omitted if not different than zero.
Since:
0.4
Version:
0.4
See Also:
  • Field Details

    • UTC

      private static final TimeZone UTC
      The timezone of the date to marshal with this adapter.
  • Constructor Details

    • UniversalTimeAdapter

      public UniversalTimeAdapter()
      Empty constructor for JAXB only.
  • Method Details

    • unmarshal

      public Date unmarshal(XMLGregorianCalendar value)
      Converts a date read from a XML stream to the object which will contain the value. JAXB calls automatically this method at unmarshalling time.
      Specified by:
      unmarshal in class XmlAdapter<XMLGregorianCalendar,Date>
      Parameters:
      value - the XML date, or null.
      Returns:
      the java.util date, or null.
    • marshal

      public XMLGregorianCalendar marshal(Date value)
      Converts the date to the object to be marshalled in a XML file or stream. JAXB calls automatically this method at marshalling time.
      Specified by:
      marshal in class XmlAdapter<XMLGregorianCalendar,Date>
      Parameters:
      value - the java.util date value, or null.
      Returns:
      the XML date, or null.