[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Serialization: additional date formats


Hi guys,

In a related note, I'm not so concerned about the format of the time string in XML, but I really don't like XMLGregorianCalendar because IBM, Sun and Apache all do it slightly differently in a way that ends up giving me ClassCast exceptions.

So I've had an idea for a solution that I wanted to bounce off you guys:

I'm going to use xsd:dateTime, XMLGregorianCalender (here after refered to as XGC) and so on just as it is during normal XSD/EMF generation. This is nice because Teneo expects the calendars and should continue to work. But since I want to present Joda-Time as the interface to my developers I'm going to add a step after my EMF generation.

My post processing step will use the code refactoring abilities of eclipse to find any EMF-generated method that accepts or returns XGC and then wraps that with a method that takes joda-time objects. I'll then mark the XGC methods deprecated. I'll also update the @generated tags and rename the wrapped method with "Gen" at the end of it so that EMF will still update the methods and not mess with my post-generated wrapper methods.

Does that sound reasonable to you guys? The post-processor shouldn't be too hard to set up, and it will keep my developers from class casting themselves into a tizzy.

                               Jason Henriksen

Ed Merks wrote:
Jan,

The answer depends on the EMF version. Before 2.3 we could not rely on anything not in the 1.4 JDK, so we had our own interface class like XMLGregorianCalendar. To hide it, we only surfaced java.lang.Object. Now in 2.3 or greater, we surface it as XMLGegorianCalendar in the APIs. You can get at the data type in XMLTypePackage from UML right?