Simple conversion between java.util.Date and XMLGregorianCalendar

后端 未结 7 1317
夕颜
夕颜 2020-12-02 04:25

I\'m looking for a simple method of converting between java.util.Date and javax.xml.datatype.XMLGregorianCalendar in both directions.

Here is the code that

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 05:20

    I too had this kind of headache. Got rid of of it by simply representing time fields as primitive long in my POJO. Now the generation of my WS client code handle everything correctly and no more XML-to-Java crap. And of course dealing with millis on the Java side is simple and painless. KISS principle rocks!

提交回复
热议问题