Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Ecore Tools » Do bounds (lower and upper) of EReference have any effect?(I set EReference lower and upper bounds, but generated Java code lets user to create unappropriate referenced objects count )
Do bounds (lower and upper) of EReference have any effect? [message #551483] Fri, 06 August 2010 15:10
Oleg Bolshakov is currently offline Oleg BolshakovFriend
Messages: 36
Registered: August 2010
Member
There two classes (Class1 and Class2) and EReferences between them in EMF model (,ecore file). EReferences multyplicity's are 0..* for src role and 0..3 for dst role. I can see two ELists created for each class but I can add any count of objects to any of the lists. The question is - what is the realisation of EReference multiplicity and why doesn't it have any effect in my Java code?

Here is code:

Package1.impl.Package1FactoryImpl.init();

Package1.meta.Package1Factory factory = Package1.meta.Package1Factory.eINSTANCE;

Class1 object1 = factory.createClass1();
object1.setName1("object1");

Class2 object2 = factory.createClass2();
object2.setName2("object2");

<...>

EList<Class1> dests = object2.getDst();
dests.add(object1);
dests.add(object7);
dests.add(object8);
dests.add(object9);
dests.add(object10);
dests.add(object11);
dests.add(object12);

<...>

[Updated on: Tue, 10 August 2010 12:31]

Report message to a moderator

Previous Topic:attributes in ecore model
Next Topic:EMF Serialization/Loading question
Goto Forum:
  


Current Time: Sun Apr 22 20:00:58 GMT 2018

Powered by FUDForum. Page generated in 0.01468 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software