Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Limitation of EObjectContainmentEList
Limitation of EObjectContainmentEList [message #870333] Mon, 07 May 2012 16:33 Go to next message
Morten MacFly is currently offline Morten MacFlyFriend
Messages: 69
Registered: July 2009
Member
Hello,

I've two ECore models, one has an attribute that references the other
(as a containment) in terms of a list. I would like to setup an upper
limit for the number of references to 2, so I set in the model: upper
bound = 2.
However, at runtime I can create more than 2 child attributes of that
type. I wonder where I am supposed to setup / implement that limit. Is
that an attribute of the model and I am just doing it wrong? Or do I
have to take care myself in the implementation?

With regards, Morten.
Re: Limitation of EObjectContainmentEList [message #870335 is a reply to message #870333] Mon, 07 May 2012 16:44 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Java code traverses many intermediate states as models are created or
edited. If limits were enforced at every possible opportunity, it would
be very difficult to do anything and performance could be very poor.

Many constraints are well-formedness rules that are checked when you
validate, so if you make changes and want prompt diagnosis of problems,
invoke Diagnostician.validate immediately afterwards.

Since validation costs, you may find that like Xtext, you want to
partition your checks into fast, normal, expensive.

Regards

Ed Willink

On 07/05/2012 17:33, Morten MacFly wrote:
> Hello,
>
> I've two ECore models, one has an attribute that references the other
> (as a containment) in terms of a list. I would like to setup an upper
> limit for the number of references to 2, so I set in the model: upper
> bound = 2.
> However, at runtime I can create more than 2 child attributes of that
> type. I wonder where I am supposed to setup / implement that limit. Is
> that an attribute of the model and I am just doing it wrong? Or do I
> have to take care myself in the implementation?
>
> With regards, Morten.
Re: Limitation of EObjectContainmentEList [message #870407 is a reply to message #870333] Tue, 08 May 2012 04:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Morten,

Comments below.

On 07/05/2012 6:33 PM, Morten MacFly wrote:
> Hello,
>
> I've two ECore models, one has an attribute that references the other
> (as a containment) in terms of a list. I would like to setup an upper
> limit for the number of references to 2, so I set in the model: upper
> bound = 2.
> However, at runtime I can create more than 2 child attributes of that
> type.
The constraints specified by the bounds are checked only when you invoke
the validator, e.g., using Diagnostician.INSTANCE.validate as when you
invoke "Validate..." in the context menu.
> I wonder where I am supposed to setup / implement that limit. Is
> that an attribute of the model and I am just doing it wrong? Or do I
> have to take care myself in the implementation?
It's taken care of, but it's possible an instance of violate those
constraints (unlike the constraints implied by static typing, which can
never be violated).
>
> With regards, Morten.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Limitation of EObjectContainmentEList [message #870774 is a reply to message #870333] Wed, 09 May 2012 15:27 Go to previous message
Morten MacFly is currently offline Morten MacFlyFriend
Messages: 69
Registered: July 2009
Member
Ok, thanks both "Eds" of you... ;-)
Previous Topic:Adapt Getters/Setters syntax
Next Topic:Influence generated method names for boolean attributes
Goto Forum:
  


Current Time: Fri Apr 26 05:56:24 GMT 2024

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

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

Back to the top