类的所有对象的静态列表 [英] Static List of all Objects of Class
问题描述
我想为我的类实现一个静态列表,其中包含的所有对象类就像下面的UML方法一样.
I wanted to implement a static List for my Class which contains all Objects of the Class like in the following UML approach.
这是编写 UML 的正确方法吗?
Is this the right way to write the UML?
如果您了解 Kotlin,还有一个使用此 UML 的问题,如果您也能帮助我,我会很高兴;) Kotlin 中对象输出类的静态列表
There is also a question which uses this UML if you know Kotlin i would be happy if you can help me there too ;) Static List of Objects out Class in Kotlin
推荐答案
这几乎是正确的.常规的 UML 符号是 IMyClass[*]
,而不是 List
.
This is almost correct. Instead of List<IMyClass>
the regular UML notation is IMyClass[*]
.
UML 2.5.1 规范第 9.5.4 节给出了以下属性的符号语法:
The UML 2.5.1 specification, section 9.5.4 gives the following notation syntax for a property:
<代码><属性>::= [<可见性>] [‘/’] <名称>[':' <prop-type>] ['[' <multiplicity-range>‘]’] [‘=’<default>] [‘{‘<prop-modifier >[‘,’ <prop-modifier >]* '}']
在你的例子中,prop-type 是 IMyClass
,multiplicity-range 是 *
.
In your case, the prop-type is IMyClass
and the multiplicity-range is *
.
这篇关于类的所有对象的静态列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!