Explicitly show an attribute in a EMF Model [message #1017014] |
Fri, 08 March 2013 15:52 |
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:
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 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.03191 seconds