Hi all,

I was trying to get to a Classifier's package, which in the UML metamodel comes 
down to navigating the namespace<->ownedElements association. However, calling 
getNamespace() on a modelElement returns null, because of what looks like a bug 
to me:

in ModelElementFacadeLogicImpl, the shieldedElement is a UmlPackage (which is 
fine, because it should be). The facade which is constructed, is thus a 
UmlPackageFacade. However, then it is cast into a NamespaceFacade, which fails 
because the MagicDraw UML Metamodel from which the facades are generated, does 
not have a generalization relationship between namespaces and packages in any 
way.

Why is there a deviation from the official UML metamodel here? Is this for 
reasons of convenience?

In my opinion, one of two things should be done here:
- connect namespace and package via generalizations
- make sure the namespace<->ownedElements association is not navigable in the 
direction of namespace

I found out that there is a getPackage() method on ModelElements which will 
fetch the package an element is in, but I feel that either getNamespace() 
should work too, or should be eliminated...

Thanks,

Hans

Attachment: pgpNfWsrMdeuL.pgp
Description: PGP signature

Reply via email to