Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsDo bounds (lower and upper) of EReference have any effect?
https://www.eclipse.org/forums/index.php/mv/msg/195549/623136/#msg_623136
Here is the code:
<...>]]>Oleg Bolshakov2010-08-12T10:58:26-00:00Re: Do bounds (lower and upper) of EReference have any effect?
https://www.eclipse.org/forums/index.php/mv/msg/195549/623139/#msg_623139
The bounds are used when you validate(). In practice performing
too-fine-grained validation is awkward. For instance changing an element
in an exactly two-off list is not possible using just the add/remove
list protocol.
If you use EMF Validation's live validation, they are checked more often.
Regards
Ed Willink
On 12/08/2010 11:58, Rrock wrote:
> 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
> - is there a realisation of EReference's bounds (for example upper
> bound) and why doesn't it have any effect in my Java code?
>
> Here is the 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);
>
> <...>]]>Ed Willink2010-08-12T16:25:17-00:00