如何在UML中绘制类的元类?
If class A is created by its __metaclass M, how does the arrow look in UML?
The stereotype syntax seems to be related.
I didn't look in Python UML tools yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会用构造型“元类”绘制依赖关系。这不是预定义的构造型,但应该让读者清楚这是什么类型的依赖关系。
I would draw a dependency with the stereotype «metaclass». This is not a predefined stereotype, but should make it clear to the read what kind of dependency this is.
元类是使用类符号加上
<>
构造型来绘制的。类与其元类之间的关系可以使用两者之间的依赖关系(带有指向元类的箭头的虚线)来定义,并用构造型<>
注释。A metaclass is drawn using the class notation plus the
<<metaclass>>
stereotype. The relationship between a class and its metaclass can be defined using a dependency relationship between the two (dashed line with the arrow pointing to the metaclass) annotated with the stereotype<<instantiate>>
.这个答案来自UML 2.2上部结构规范:
更多课堂答案:
例如,“create”关键字可以出现在操作名称旁边,表明它是构造函数操作,它也可以用于标记两个类之间的使用依赖关系,以表明一个类创建另一个类的实例。 ” (第 690 页[706-AdobeReader],附录 B,未编号的第 4 段,页面第 1 段)我认为这适用于元类。
刻板印象答案:
这是一种答案,但并不能推断出您在帖子中使用的词“创建”,而可能只是一个含糊不清的词选择。符号是带有实心三角形的法线。我还看到过在 Rational Software Modeler 等工具中使用
<>
关键字。 (第 657 页[673-AdobeReader] 图 18.3 和 659 图 18.5,配置文件部分)您可能还想澄清您是指 MOF/模型定义意义上的元类还是某种语言或其他上下文中的元类。
如果您改进您的问题,请告诉我。
This answer is from the UML 2.2 Superstructure Specification:
More class answer:
"For instance, the «create» keyword can appear next to an operation name to indicate that it is a constructor operation, and it can also be used to label a Usage dependency between two Classes to indicate that one Class creates instances of the other." (Pg 690[706-AdobeReader], Appendix B, Unnumbered 4th paragraph, 1st on the page) I think this would apply to meta-classes.
Stereotype answer:
This is kind of an answer, but does not infer "create" which is the word you used in your post, but might have just been an ambiguous word choice. The notation is an normal line with a filled triangle. I have also seen the keyword of
<<extend>>
used in tools like Rational Software Modeler. (Pg 657[673-AdobeReader] Figure 18.3 and 659 Figure 18.5, Profile Section)You might also want to clarify if you mean meta-class in the MOF/Model definition sense or in some language or other context.
Let me know if you refine your question.