如何在UML中绘制类的元类?

发布于 2024-08-05 17:46:45 字数 424 浏览 2 评论 0原文

如果类 A 由其 __metaclass M 创建,则箭头在 UML 中看起来如何?

stereotype 语法似乎是相关的。

我没有查看 Python 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一萌ing 2024-08-12 17:46:46

我会用构造型“元类”绘制依赖关系。这不是预定义的构造型,但应该让读者清楚这是什么类型的依赖关系。

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.

‘画卷フ 2024-08-12 17:46:45

元类是使用类符号加上 <> 构造型来绘制的。类与其元类之间的关系可以使用两者之间的依赖关系(带有指向元类的箭头的虚线)来定义,并用构造型 <> 注释。

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>>.

海的爱人是光 2024-08-12 17:46:45

这个答案来自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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文