Class XMLDateAdapter


  • public class XMLDateAdapter
    extends javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.util.Date>
    XML adapter class to marshal java.util.Date properties to simple date format without time and timezone information to store birth dates for example. JAXB using XmlSchemaType(name="date") annotation does not suppress timezone (e.g.: 1966-12-27+01:00)
    Author:
    K.Jaensch, klausj@phonetik.uni-muenchen.de
    • Constructor Summary

      Constructors 
      Constructor Description
      XMLDateAdapter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String marshal​(java.util.Date date)  
      java.util.Date unmarshal​(java.lang.String dateString)  
      • Methods inherited from class java.lang.Object

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

      • SIMPLE_DATE_FORMAT_STRING

        public static final java.lang.String SIMPLE_DATE_FORMAT_STRING
        See Also:
        Constant Field Values
    • Constructor Detail

      • XMLDateAdapter

        public XMLDateAdapter()
    • Method Detail

      • marshal

        public java.lang.String marshal​(java.util.Date date)
                                 throws java.lang.Exception
        Specified by:
        marshal in class javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.util.Date>
        Throws:
        java.lang.Exception
      • unmarshal

        public java.util.Date unmarshal​(java.lang.String dateString)
                                 throws java.lang.Exception
        Specified by:
        unmarshal in class javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.util.Date>
        Throws:
        java.lang.Exception