|
|
|
|
Re: Generate model only once for different domains [message #539532 is a reply to message #539402] |
Fri, 11 June 2010 08:30 |
Udo Walker Messages: 81 Registered: July 2009 |
Member |
|
|
Hi Ed,
in my server code I want to get rid of the extra operations in each setter.
Instead of having this:
public void setKey(String newKey) {
String oldKey = key;
key = newKey;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
MenuPackage.DESCRIPTION__KEY, oldKey, key));
}
I want to have this:
public void setKey(String newKey) {
key = newKey;
}
But in an editor in my Eclipse plugin I do want to have the first piece of code.
To solve this I tried to create a bundle where notification is turned off (code of 2nd piece is generated) and a second bundle, where the setter is overwritten by the 2nd piece of code. The second bundle inherits the model from 1st bundle. I want that the EMF is generating that for me in some way. But how I did it it did not work.
Udo
[Updated on: Fri, 11 June 2010 09:10] Report message to a moderator
|
|
|
Re: Generate model only once for different domains [message #539633 is a reply to message #539532] |
Fri, 11 June 2010 14:22 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Udo,
Comments below.
Udo wrote:
> Hi Ed,
>
> in my server code I want to get rid of the extra operations in each
> setter.
>
> Instead of having this:
>
>
> public void setKey(String newKey) {
> String oldKey = key;
> key = newKey;
> if (eNotificationRequired())
> eNotify(new ENotificationImpl(this, Notification.SET,
> MenuPackage.DESCRIPTION__KEY, oldKey, key));
> }
>
>
> I want to have this:
>
>
> public void setKey(String newKey) {
> key = newKey;
> }
>
Why? Is your server running low on bytes? What specific benefits do
you hope to gain at the cost of maintaining two separate implementations?
>
> But in an editor in my Eclipse plugin I do want to have the first
> piece of code.
> To solve this I tried to create a bundle where notification is turned
> of (code of 2nd piece is generated) and a second bundle, where the
> setter is overwritten by the 2nd piece of code. The second bundle
> inherits the model from 1st bundle. I want that the EMF is generating
> that for me in some way. But how I did it it did not work.
> Udo
Note that even if you got rid of it for the setters, the list
implementations, at least the ones that support bidirectional
references, proxy resolution, and containment, still include it.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.04158 seconds