Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: olafk on June 07, 2006, 03:33:56 am
-
Hi all.
I have a need to model dependencies from (class) operations to other classes. Say, for example, an operation on a class might throw exceptions of sorts and thus is dependent on the exception classes. I would want to explicit represent this dependency in the model...
Is there any way to establish such dependency associations from operations? (Even better if they'd then be treated like any old dependency: stereotypes, etc.)
cheers,
-olaf
-
Hi all.
I have a need to model dependencies from (class) operations to other classes. Say, for example, an operation on a class might throw exceptions of sorts and thus is dependent on the exception classes. I would want to explicit represent this dependency in the model...
Is there any way to establish such dependency associations from operations? (Even better if they'd then be treated like any old dependency: stereotypes, etc.)
cheers,
-olaf
Hi Olaf,
UML doesn't (directly) allow relationships from Features (such as Operations and Attributes) to Classes.
That having been said, relationships can be implied: For example, a named navigable Association is defined as an Attribute. Thus for your purposes, you could use a similar idea.
If you draw the dependency from the Class with the Operation to the Class referenced by the Operation, and name the target role the name of the operation, you are effectively creating the type of dependency you are requiring.
Unfortunately, you need to do this manually.
Does that help?
Paolo
-
Could you model these as a <<uses>> (perhaps it is <<use>> in UML 2.0) relationship between the two classes?
-
Thanks guys, indeed quite helpful. More than anything, it gets the creative mind going... Something I didn't quite mention is that I am feeding the (exported) model into the AndroMDA generator tool... so there's a few other issues to consider.
What I ended up doing is taking up Paolo's idea, but I am also adding a stereotype of <<Throws>> to the dependency (which is picked up in AndroMDA).
In short, both suggestions most welcome...
cheers,
-olaf