Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Type is introduced when model is serialized
Type is introduced when model is serialized [message #1744155] Thu, 22 September 2016 20:58 Go to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
My ecore model has reference to an interface, which is implemented by two concrete objects. Here are parts of model in question:

  <eClassifiers xsi:type="ecore:EClass" name="Zoo">
    <eStructuralFeatures xsi:type="ecore:EReference" name="animal" upperBound="-1"
        eType="#//Animal" containment="true"/>
  </eClassifiers>
...
...
  <eClassifiers xsi:type="ecore:EClass" name="Lion" eSuperTypes="#//Animal"/>
  <eClassifiers xsi:type="ecore:EClass" name="Monkey" eSuperTypes="#//Animal">


When I add a Lion to my model: Zoo.getAnimal().add(Lion) and Zoo.getAnimal().add(Monkey) the model is serialized as follows:

<bdi:Zoo>
     <animal xsi:type="bdi:Lion"/>
    <animal xsi:type="bdi:Monkey"/>
</bdi:Zoo>


Is it possible to persist model so that I don't get type generated for animal element, but instead concrete type is serialized:

<bdi:Zoo>
     <Lion/>
    <Monkey/>
</bdi:Zoo>


Thanks,
Alex
Re: Type is introduced when model is serialized [message #1744177 is a reply to message #1744155] Fri, 23 September 2016 08:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
With a great deal of effort and all kinds of magical extended metadata annotations along with a messier model API you could achieve something like this as describe in this old blog:

http://ed-merks.blogspot.de/2007/12/winters-icy-grip.html


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Type is introduced when model is serialized [message #1744254 is a reply to message #1744177] Fri, 23 September 2016 15:54 Go to previous message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
Thanks Ed!
Previous Topic:Delete
Next Topic:Is it correct to say EMF uses the decorator pattern by default?
Goto Forum:
  


Current Time: Fri Apr 19 01:52:46 GMT 2024

Powered by FUDForum. Page generated in 0.02299 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top