Enumeration literal and reserved words [message #1847047] |
Wed, 13 October 2021 06:44 |
Yves BERNARD Messages: 146 Registered: July 2014 |
Senior Member |
|
|
I have an enumeration that contains both "in" and "out" as its literals. According to the documentation, and if I get it right, the proper syntax referring to the "in" literal should be : #"in". However, when used in a rule for assigning a value to a property, I get the following:
direction <- #out -- works fine, the "out" literal is assigned
while
direction <- #"in" -- does not work, no value is assigned
Do I missed something ?
Yves
|
|
|
|
Re: Enumeration literal and reserved words [message #1847104 is a reply to message #1847076] |
Thu, 14 October 2021 16:43 |
Yves BERNARD Messages: 146 Registered: July 2014 |
Senior Member |
|
|
Thank you Dennis.
But actually, we cannot say it works. Indeed, in the out model, the direction does not appears. You can say that this is because "in" the default value for UML::Parameter, which is correct, but it's not the case in my target metamodel and the value is not serialized either.
I guess you will ask for a sample model, with the appropriate metamodel. I'll try to build such a bundle with a minimum size...
Also, I will try to modify your example so that there is a test on the "in" value because this does not work here either.
Yves
[Updated on: Fri, 15 October 2021 06:34] Report message to a moderator
|
|
|
Re: Enumeration literal and reserved words [message #1847139 is a reply to message #1847104] |
Fri, 15 October 2021 16:00 |
Yves BERNARD Messages: 146 Registered: July 2014 |
Senior Member |
|
|
Hi Dennis,
Some news about this topic: I understand what happens now!
So, first, I confirm that ATL works fine and that it is not responsible for the results I get.
Explanation: as discussed, in your example the fact that the direction does not appear in the generate file is normal because the "in" direction is the default.
However in my target metamodel the direction has no default value,. So I was expecting that the value of the direction is serialized in all cases. But that was not what I observed. The direction was serialized for all direction values except the "in" one.
In fact, it looks like ecore assumes there is always a default value . If it is not specified, it considers that it is the first one in the enumeration. Indeed, if I modified the target metamodel so that the default value for the direction is explicitly set to "out", the directions with the value "in" are serialized.
Yves
|
|
|
Powered by
FUDForum. Page generated in 0.02136 seconds