Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Explicitly show an attribute in a EMF Model
Explicitly show an attribute in a EMF Model [message #1017014] Fri, 08 March 2013 15:52 Go to next message
Iban Ayestaran is currently offline Iban AyestaranFriend
Messages: 58
Registered: September 2011
Member
I am afraid this may be a very stupid question, but I cannot find any solution in the internet.

In my Ecore model, I have a EClass called Port, which has an attribute Type: PortTypes, and a name. PortTypes is a EEnum with the possible values "Input" and "Output".

When I define a Port in my EMF model, if the port type is output, the XML I get is the way I would like to be, like this:
<port Name="port1" PortType="Output"/>


But for input ports, I get this:
<port Name="port2"/>


That is, if the port is of type input, the portType is not explicitly defined in the XML model, and I would like it to be like this:
<port Name="port1" PortType="Input"/>


Any suggestion?
Re: Explicitly show an attribute in a EMF Model [message #1017020 is a reply to message #1017014] Fri, 08 March 2013 16:29 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Iban,

EMF won't serialize a feature if eIsSet is false. You could get around
that by setting an explicit default for this feature and use the
OPTION_KEEP_DEFAULT_CONTENT save option. Or you could make the feature
unsettable and always be sure to set it two one of those two values.
Then you'd be able to detect that the value was missing in the
serialization because isUnsetPortType would be false in that case.


On 08/03/2013 4:52 PM, Iban Ayestaran wrote:
> I am afraid this may be a very stupid question, but I cannot find any
> solution in the internet.
>
> In my Ecore model, I have a EClass called Port, which has an attribute
> Type: PortTypes, and a name. PortTypes is a EEnum with the possible
> values "Input" and "Output".
> When I define a Port in my EMF model, if the port type is output, the
> XML I get is the way I would like to be, like this:
> <port Name="port1" PortType="Output"/>
>
> But for input ports, I get this:
> <port Name="port2"/>
>
> That is, if the port is of type input, the portType is not explicitly
> defined in the XML model, and I would like it to be like this:
> <port Name="port1" PortType="Input"/>
>
> Any suggestion?


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] Resolve cross references for new objects that has not been committed yet
Next Topic:Value of Enumeration is not legal
Goto Forum:
  


Current Time: Fri Apr 26 18:02:00 GMT 2024

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

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

Back to the top