The opposite relation has to be a 1:1 relation. It is -- to the best of my knowledge -- not possible to have two references point to the same opposite reference. This is more clear when creating EMF models using the Ecore editor instead of annotated Java classes.
In your case, you could either have one List<ContainedObject> containedObjects
and create two additional getter methods getVariables()
and getCategories()
, filtering the respective elements from that common list, or you could create two container
references, one for categories
and one for variables
.
Alternatively, you could drop the explicit container
reference and just use the implicit eContainer
/ eContents
features of EObject
.