First of all : thank for the support !
My problem : I want to simply test if an "enumerated" attribute is defined or not.
Let's say I have :
- an EnumValues enumeration with 2 values VALEUR1 and VALEUR
- an EObject object with an optional attribute value
I would have expected to test the value existence thanks to this expression :
object.value.oclIsUndefined()
But this expression always retuens true as the value attribute seems to be initialized with the first value of the enumeration. The only bypass way I've found is to not declare EnumValues as an Enum but as an EObject. Then the oclIsUndefined() method returns false when the attribute is not set in the model. BTW my model is generated thanks to Xtext.
It seems to be a stupid question but I'm not able to find the answer on Google, in the OCL specification or in the Acceleo resources.
The only material I've found here says that the only way to achieve this is to use the isUndefined or the more general isUndefined('value') OCL helper methods. But I'm not able to decline this in the Acceleo environnement.
Do you have any idea ?
Thanks in advance for your reply !
Stéphane