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 10:52 Go to next message
Iban Ayestaran is currently offline Iban Ayestaran
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 11:29 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26014
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?
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: Sat Aug 30 18:36:16 EDT 2014

Powered by FUDForum. Page generated in 0.01926 seconds