Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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] Mon, 09 March 2020 02:22 Go to next message
Prashanth Rao is currently offline Prashanth RaoFriend
Messages: 1
Registered: March 2020
Junior Member
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 16:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31835
Registered: July 2009
Senior Member
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.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to add a attribute or property to a EAttribute type? [message #1822549 is a reply to message #1822545] Mon, 09 March 2020 16:56 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6556
Registered: July 2009
Senior Member
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: Sat Apr 17 09:42:20 GMT 2021

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

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

Back to the top