How to do JAXB annotations in ecore? [message #894447] |
Mon, 09 July 2012 05:34  |
Eclipse User |
|
|
|
Hi there,
Is it possible to annotate an ecore model(or genmodel) with JAXB annotations? I need to have JAXB annotations in the generated code. Any help is appriciated.
Thanks a mil
kosala
|
|
|
|
|
|
|
|
Re: How to do JAXB annotations in ecore? [message #1759233 is a reply to message #894506] |
Sat, 08 April 2017 03:54  |
Eclipse User |
|
|
|
Hello,
I'm using EMF since couple of weeks and I'm now trying to generate Java classes annotated with JAXB annotations like the ones generated form a XSD. I've exported the .ecore to a .xsd file but this way I loose all the features of EMF.
There is an Eclipse plugin - EMF REST - on the web but it and does not do exactly what I need and have couple of bugs. It uses its own JET templates to generate the annotations. See https://github.com/SOM-Research/emf-rest/blob/master/emf-rest-src/emf-rest/templates/model/Class.javajet line 791. Is it possible to integrate a solution like that into EMF? Maybe a parameter that enables the generation of the annotations?
Why do I need this? Because I want to offer a public REST interface to my application specified by a XSD. This way every client can send plain XML without knowing that JAX-RS (Jersey) deserialize it to EObjects.
Gegards
Veselin
|
|
|
Re: How to do JAXB annotations in ecore? [message #1759241 is a reply to message #1759233] |
Fri, 07 April 2017 20:51  |
Eclipse User |
|
|
|
I doubt what you're trying to do is sensible and I still don't really get it. You talk about "plain XML" sent by clients, so I get the impression that clients will only have to know the XML Schema to which the "plain XML" must conform. That whole side of things seems unrelated to any JAXB annotations on your side. And of course you know that EMF can generate a model from an XSD and can read and write instances that conform to this XSD so it seems that's sufficient for clients not to care about EMF but only about the XSD and for you to use EMF to read instances conforming to that XSD. So what's missing? Why do you need JAXB annotations? It doesn't sound like the clients need them. I suppose it has something to do with this JAX-RS thing, but I know nothing about that.
Before you go too far down this path, have you tried manually adding the annotations you hope to have generated to see if it even works. As I said EMF implementation classes are not compatible with what's generated by JAXB, so I just don't see how this could possibility all fit together.
|
|
|
Re: How to do JAXB annotations in ecore? [message #1759247 is a reply to message #1759233] |
Sat, 08 April 2017 03:24  |
Eclipse User |
|
|
|
Hi
It might help if you provide us with a diagram showing your workflow so that we can see:
a) your mandated master information representations
b) your free choice master information representations
c) your mandated derived information representations
d) your free choice derived information representations
e) your mandated conversions and technologies
f) your free choice conversions and technologies
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.04847 seconds