oclIsUndefined and empty String [message #498536] |
Tue, 17 November 2009 06:49  |
Eclipse User |
|
|
|
Originally posted by: formatzeh.gmx.de
I have some ocl constraints in my EMF meta-model which should evaluated
at runtime. One of my classes has two attributes (category and url) of
type String where only one of both must be set (xor). Therefor I defined
the following constraint:
(self.url.oclIsUndefined() and (not
self.classificationCategory.oclIsUndefined())) or ((not
self.url.oclIsUndefined()) and self.classificationCategory.oclIsUndefined())
The first time I create a model with the EMF-generated editor I only set
url and the constraint wasn't violated. Then I set the category as well
and the violation was indicated correctly. After that I removed the
category again by deleting the String in the properties view. But
surprisingly the message popped up that the constraint still is
violated. Then I saw in the source of the model that category had the
empty string category="" after deleting it. After removing it by hand
from the source the evaluation was successful again. So if category has
the empty string oclIsUndefined doesn't return true - well that's ok but
not in my case. So can you help me with the correct XOR expression
respecting the empty string as well?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05096 seconds