"Class variable"-like behaviour in Ecore model [message #664288] |
Fri, 08 April 2011 05:44  |
Eclipse User |
|
|
|
Hi,
as class variables i.e. static variables are not supported by Ecore for good reasons, I wonder if there's a pattern or best practice to model something close enough to this, i.e. references which are shared by all instances of the class in question.
I can think of a way to enforce this with an OCL constraint, but this would mean you still have to set the reference "manually" each time an instance is created. is there a better way?
Thanks in advance!
|
|
|
|
|
Re: "Class variable"-like behaviour in Ecore model [message #664366 is a reply to message #664288] |
Fri, 08 April 2011 10:58  |
Eclipse User |
|
|
|
Thanks a lot Ed & Ed for your replies!
Quote: | Is this an issue about a default value for a single-valued non-containment reference as Ed assumes, or more generally about sharing read-only resources (containing shared constants)?
|
In our specific case, it's about a non-containment reference which should be a list of the same values for every instance of the EClass. Default i.e. initial value is sufficient, but of course it would be a plus, if the lists were in sync. I will have a look into the OCL delegates indicated by Ed Willink.
Just in case, is there a reasonable non-OCL way to do this?
|
|
|
Powered by
FUDForum. Page generated in 0.04507 seconds