|define a operation for a given type. [message #35271]
||Fri, 03 August 2007 18:59
Originally posted by: firstname.name.gmail.com|
I have some questions on the mechanisms entailed to create operation in
environment. When we create a operation (for example with the defineOperation
method), we have to precise its context classifier.
In a uml environment, I would expect to make available a given operation only
for a given type. For example, to create an operation for only usable for the
context package. To do that I have to retrieve at first its context. It is its
metaclass (for example with getMetclass(Package)).
but I should do something wrong because It doesn't work. To add a operation on a
Package, I have to use the context owner OclAny.
If I debug it, I can see, that environment operation found for Package are those
for OclAny (UMLReflection will be invoked at first for Package, then for
OclAnyVoid). At some point, I understand that a user operation can't be "added"
in the corresponding classifier, and so that the classifier.getAllOperation()
may not include my operation.
So my question is to know if/how I may restrict a operation/variable for a type.
thanks a lot.