|
Re: Limitation of EObjectContainmentEList [message #870335 is a reply to message #870333] |
Mon, 07 May 2012 16:44 |
Ed Willink 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 |
Ed Merks 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/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02954 seconds