I find onEventName() the easiest naming scheme for event callbacks, but how to indicate which events an object can broadcast I've not found any solution. An extended UML class diagram that would allow for customized containers (besides the attribute and method contrainers) could be an alternative, if some tool would support it.
I don't think there is any specific UML notation for showing events that a Class can broadcast. To show events that a Class can receive, you want a Reception element. This has a similar notation to an Operation, with the «signal» keyword.
发布评论
评论(5)
只需将“事件”构造型添加到分类器属性即可。
Just add an «event» stereotype to a classifier attribute.
我发现 onEventName() 是事件回调最简单的命名方案,但是如何指示对象可以广播哪些事件我还没有找到任何解决方案。 如果某些工具支持的话,允许定制容器(除了属性和方法容器之外)的扩展 UML 类图可能是一种替代方案。
I find onEventName() the easiest naming scheme for event callbacks, but how to indicate which events an object can broadcast I've not found any solution. An extended UML class diagram that would allow for customized containers (besides the attribute and method contrainers) could be an alternative, if some tool would support it.
我认为没有任何特定的 UML 符号来显示类可以广播的事件。 要显示类可以接收的事件,您需要一个 Reception 元素。 这与操作具有类似的表示法,带有“signal”关键字。
I don't think there is any specific UML notation for showing events that a Class can broadcast. To show events that a Class can receive, you want a Reception element. This has a similar notation to an Operation, with the «signal» keyword.
我在模型“PublishedEvent”中创建了一个带有操作基类的构造型。 我将构造型应用到类中的操作中。
I create a stereotype in the model, "PublishedEvent", with a BaseClass of Operation. I apply the stereotype to the Operations in the class.
这不是我喜欢给出的答案类型,但是Microsoft Office 网站上有答案。
Not the type of answer that I like to give, but Microsoft has an answer on the Office website.