|Package as Ocl Context [message #894051]
||Fri, 06 July 2012 09:48
| fv fv
Registered: April 2012
up to now I'm using a function parseOCL(org.eclipse.uml2.uml.Class c, java.lang.String s) which parses an OCL Constraint.
The body of this function consists basically of the following lines:
constraint = (Constraint)oclhelper.createInvariant(s);
Now, I have an OCL Constraint which uses several classes (let's say A and B) which are not connected through an association. The constraint has the following expression:
A.id + B.id >= 0
Is it possible to parse such an OCL Constraint?
What do I have to give setContext() as parameter? If I use Class A as parameter, the raised error tells me:
which is correct because Class A can't see B.id (because of the missing association)
I'm wondering if it's possible to call setContext with the package which contains the classes (A and B in the example) but I get the following error:
java.lang.ClassCastException: org.eclipse.uml2.uml.internal.impl.PackageImpl cannot be cast to org.eclipse.uml2.uml.Classifier
Is there a possiblity to parse such a Constraint?
Powered by FUDForum
. Page generated in 0.04851 seconds