[OCLinEcore] Setting Delegate (initial) => UnsupportedOperationException in dynamicSet [message #1075407] |
Mon, 29 July 2013 11:22 |
Kirsten M. Z. Messages: 132 Registered: July 2010 |
Senior Member |
|
|
Hi,
I have problems using a "Setting Delegate" for providing the initial value of an EAttribute (type: EInt).
I use the following Model (class and its attributes)
MyClass
-> myAttribute : EInt
-> myAttributeWithInitialValue : EInt
OCL Setting Delegate:
Source = "http://www.eclipse.org/emf/2002/Ecore/OCL"
Key = "initial"
Value = 100
Actually, the setting delegate works, i.e. when creating an object of type MyClass it has an attribute "myAttributeWithInitialValue" with value "100". However, it is not possible to set the value of "myAttributeWithInitialValue" any more (=> UnsupportedOperationException). Changing the value of "myAttribute" is possible, of course.
I debugged into it and found the problem: for "myAttributeWithInitialValue" and "myAttribute" the method "dynamicSet" is called, which again uses the delegate for setting the value. However, for "myAttributeWithInitialValue" the delegate is an object of type "OCLSettingDelegate" which does not provide the setting of values. In my opinion, this is meaningful for delegate type "derive", but not for "initial" (both OCL setting delegates).
I don't understand the behavior... Is this a bug or a feature?
|
|
|
Re: [OCLinEcore] Setting Delegate (initial) => UnsupportedOperationException in dynamicSet [message #1075597 is a reply to message #1075407] |
Mon, 29 July 2013 18:08 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi
You don't provide me enough information to make any useful comment.
Your model is in no language that I recognize and not one that I can load.
OCLSettingDelegate has no package path so I can't tell what that is either.
Zipping up an example project will generally me and ytou a lot of time.
Regards
Ed Willink
On 29/07/2013 12:22, Kirsten M. Z. wrote:
> Hi,
>
> I have problems using a "Setting Delegate" for providing the initial
> value of an EAttribute (type: EInt).
>
> I use the following Model (class and its attributes)
>
> MyClass
> -> myAttribute : EInt
> -> myAttributeWithInitialValue : EInt
> OCL Setting Delegate:
> Source = "http://www.eclipse.org/emf/2002/Ecore/OCL"
> Key = "initial"
> Value = 100
>
> Actually, the setting delegate works, i.e. when creating an object of
> type MyClass it has an attribute "myAttributeWithInitialValue" with
> value "100". However, it is not possible to set the value of
> "myAttributeWithInitialValue" any more (=>
> UnsupportedOperationException). Changing the value of "myAttribute" is
> possible, of course.
>
> I debugged into it and found the problem: for
> "myAttributeWithInitialValue" and "myAttribute" the method
> "dynamicSet" is called, which again uses the delegate for setting the
> value. However, for "myAttributeWithInitialValue" the delegate is an
> object of type "OCLSettingDelegate" which does not provide the setting
> of values. In my opinion, this is meaningful for delegate type
> "derive", but not for "initial" (both OCL setting delegates).
>
> I don't understand the behavior... Is this a bug or a feature?
|
|
|
|
|
|
|
|
Re: [OCLinEcore] Setting Delegate (initial) => UnsupportedOperationException in dynamicSe [message #1075843 is a reply to message #1075829] |
Tue, 30 July 2013 07:17 |
Kirsten M. Z. Messages: 132 Registered: July 2010 |
Senior Member |
|
|
BTW:
Shouldn't the correct output be:
0
100
0
200
(your output was: 0,0,0,200)
Ok, I understand that setting delegates do not support "regular setting", but only for "derived". However, I work with "initial", which is a setting delegate according to http://wiki.eclipse.org/MDT/OCLinEcore (I don't understand why "setting delegate", but nvm). "Setting" an attribute initially is not really a model change (by OCL) I guess. I expect that a property with "initial" can be changed/set? Otherwise, I could use "derived"?!?
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05038 seconds