Class Iso8601DateTimeAdapter


  • public class Iso8601DateTimeAdapter
    extends javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,​java.util.Date>
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.text.DateFormat getFormat()  
      java.lang.String marshal​(java.util.Date date)
      We will always write in UTC with no offset, so no need for extra logic here.
      java.util.Date unmarshal​(java.lang.String s)
      Until Java 7, SimpleDateFormat doesn't support ISO 8601 time zones ('Z', '+0000', '-03', etc.) This extra parsing ensures that we can *read* them.
      • Methods inherited from class java.lang.Object

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

      • Iso8601DateTimeAdapter

        public Iso8601DateTimeAdapter()
    • Method Detail

      • unmarshal

        public java.util.Date unmarshal​(java.lang.String s)
                                 throws java.lang.Exception
        Until Java 7, SimpleDateFormat doesn't support ISO 8601 time zones ('Z', '+0000', '-03', etc.) This extra parsing ensures that we can *read* them.
        Specified by:
        unmarshal in class javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,​java.util.Date>
        Throws:
        java.lang.Exception
      • marshal

        public java.lang.String marshal​(java.util.Date date)
                                 throws java.lang.Exception
        We will always write in UTC with no offset, so no need for extra logic here.
        Specified by:
        marshal in class javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,​java.util.Date>
        Throws:
        java.lang.Exception
      • getFormat

        public static java.text.DateFormat getFormat()