|Having a reference specify itself for the EOpposite [message #1015089]
||Wed, 27 February 2013 07:12
| Cedric Moonen
Registered: August 2009
Suppose that I have a reference having the same EClass as source and destination (the EClass references itself). Why can't I specify this reference as an EOpposite as itself ?
There are cases where this might be useful. Suppose for instance that I have an EClass representing a gear wheel ("GearWheel") which contains a reference to itself (the reference specify the other GearWheel instance to which it is connected). In GearWheel1, if I specify that the connected gear wheel is GearWheel2, I would like that GearWheel2 reflects this as well, the same way an EOpposite reference works.
Is there a reason why something like that is not possible in EMF ? In the ecore editor (and also in the diagram editor), you can't select yourself (the reference) as EOpposite in this specific case.
BTW, this is a limitation of the EMF editor and the diagram editor, because it is perfectly possible to make such a model using the OCLinEcore editor: the generated ecore model is then featuring the EOpposite relation as expected. If I create a dynamic instance of such a model, the behavior is also reproduced (the GearWheel2 is updated when I selected it as a connected gear wheel).