Skip to main content



      Home
Home » Modeling » EMF » How to add a attribute or property to a EAttribute type?
How to add a attribute or property to a EAttribute type? [message #1822505] Sun, 08 March 2020 22:22 Go to next message
Eclipse UserFriend
I have a EMF ecore model where I have defined a EAttribute to EClass type, let's say EClass type Software and created Commit EAttribute. I made this to use EAnnotation to make Commit always as element using ExtendedMetaData and in xml it looks like this
<Software>
        <Commit>blabla</commit>
<Software> 


So far so good, but now there is a requirement comes that to add attribute/property lets say [b]repo[b] to be added to Commit type. So I planned to create Commit as EClass type instead of EAttribute and added 2 EAttribute type Commit and Repo. Then the problem arise because commit value is also coming as an attribute/property to Commit tag. it looks like this
<Software>
      <Commit repo="blarepo" commit="blabla"/>
<Software> 


I want to have the ouput something like this
<Software>
      <Commit repo="blarepo">blabla</commit>
<Software> 


Could you please tell me how to achieve this case using ecore model.

Thank you very much in advance.
Re: How to add a attribute or property to a EAttribute type? [message #1822545 is a reply to message #1822505] Mon, 09 March 2020 12:35 Go to previous messageGo to next message
Eclipse UserFriend
I think the extended metadata annotation for the Commit EClass needs to be simple and then one EAttribute can have extended metadata annotation kind simple so that it's serialized as the simple element content of the Commit EClass.
Re: How to add a attribute or property to a EAttribute type? [message #1822549 is a reply to message #1822545] Mon, 09 March 2020 12:56 Go to previous message
Eclipse UserFriend
In Ecore only classes have attributes. So, if something needs to have an attribute it must be a class.

Cheers
/Eike
Previous Topic:Custom Label Provider
Next Topic:Generation of ID's
Goto Forum:
  


Current Time: Wed Jul 16 07:10:19 EDT 2025

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

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

Back to the top