Home » Modeling » UML2 » UML2EcoreConverter, default values and EAttribute.unsettable
UML2EcoreConverter, default values and EAttribute.unsettable [message #878633] |
Tue, 29 May 2012 16:13 |
Carsten Reckord Messages: 139 Registered: July 2009 |
Senior Member |
|
|
Hi,
We have various profiles containing (mostly string typed) properties with
default values and would like to set the applications' values to null
explicitly, which works fine on the DynamicEObject instances, but breaks
between saving and loading.
In Ecore, handling of null values for EAttributes depends on the attribute's
default value and its 'unsettable' flag.
If I set an attribute value to null and that attribute has a default value,
saving and reloading will change the attribute's value to the default value
(since null is interpreted as not being changed from the default value
during save/load). In Ecore, this behavior can be controlled through the
'unsettable' flag of the attribute. Setting that to true will interpret null
as literally null.
Since no such flag exists on the UML2 Property, the UML2EcoreConverter does
not handle this, leaving all resulting EAttributes as unsettable=false,
causing the problems we see.
Would it be reasonable to introduce an option to the converter to change the
'unsettable' value
- either to simply always be true
- or even better, to be true for UML2 Properties with a lower bound of 0 ?
Best regards,
Carsten
|
|
|
Re: UML2EcoreConverter, default values and EAttribute.unsettable [message #878641 is a reply to message #878633] |
Tue, 29 May 2012 16:25 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi
If you apply the Ecore Profile and the EAttribute/EReference stereotype
you get the 'missing' facilities.
Regards
Ed Willink
On 29/05/2012 17:13, Carsten Reckord wrote:
> Hi,
>
>
> We have various profiles containing (mostly string typed) properties with
> default values and would like to set the applications' values to null
> explicitly, which works fine on the DynamicEObject instances, but breaks
> between saving and loading.
>
> In Ecore, handling of null values for EAttributes depends on the attribute's
> default value and its 'unsettable' flag.
>
> If I set an attribute value to null and that attribute has a default value,
> saving and reloading will change the attribute's value to the default value
> (since null is interpreted as not being changed from the default value
> during save/load). In Ecore, this behavior can be controlled through the
> 'unsettable' flag of the attribute. Setting that to true will interpret null
> as literally null.
>
> Since no such flag exists on the UML2 Property, the UML2EcoreConverter does
> not handle this, leaving all resulting EAttributes as unsettable=false,
> causing the problems we see.
>
> Would it be reasonable to introduce an option to the converter to change the
> 'unsettable' value
> - either to simply always be true
> - or even better, to be true for UML2 Properties with a lower bound of 0 ?
>
> Best regards,
> Carsten
|
|
|
Re: UML2EcoreConverter, default values and EAttribute.unsettable [message #878650 is a reply to message #878641] |
Tue, 29 May 2012 16:42 |
Carsten Reckord Messages: 139 Registered: July 2009 |
Senior Member |
|
|
Hi Ed,
oh sorry, my simple usage search of setUnsettable didn't turn that up...
Best regards,
Carsten
On 29.05.2012 18:25, Ed Willink wrote:
> Hi
>
> If you apply the Ecore Profile and the EAttribute/EReference stereotype
> you get the 'missing' facilities.
>
> Regards
>
> Ed Willink
>
>
> On 29/05/2012 17:13, Carsten Reckord wrote:
>> Hi,
>>
>>
>> We have various profiles containing (mostly string typed) properties with
>> default values and would like to set the applications' values to null
>> explicitly, which works fine on the DynamicEObject instances, but breaks
>> between saving and loading.
>>
>> In Ecore, handling of null values for EAttributes depends on the attribute's
>> default value and its 'unsettable' flag.
>>
>> If I set an attribute value to null and that attribute has a default value,
>> saving and reloading will change the attribute's value to the default value
>> (since null is interpreted as not being changed from the default value
>> during save/load). In Ecore, this behavior can be controlled through the
>> 'unsettable' flag of the attribute. Setting that to true will interpret null
>> as literally null.
>>
>> Since no such flag exists on the UML2 Property, the UML2EcoreConverter does
>> not handle this, leaving all resulting EAttributes as unsettable=false,
>> causing the problems we see.
>>
>> Would it be reasonable to introduce an option to the converter to change the
>> 'unsettable' value
>> - either to simply always be true
>> - or even better, to be true for UML2 Properties with a lower bound of 0 ?
>>
>> Best regards,
>> Carsten
>
|
|
|
Goto Forum:
Current Time: Fri Sep 20 00:03:42 GMT 2024
Powered by FUDForum. Page generated in 0.03159 seconds
|