我将如何显示该字段
private static final int DAMAGE = 3;
在 UML 图中?
它应该显示为:- DAMAGE : 3 : int
吗?
最佳答案
你这样显示。
Private
用减号表示。 static
属性用下划线表示。初始值显示为 = <value>
.自从我了解到 final
表示一个常量,您将应用 isConst
显示为 {readOnly}
的属性.
另见 p. UML 规范的 111:
<property> ::= [<visibility>] [‘/’] <name> [‘:’ <prop-type>] [‘[‘ <multiplicity-range> ‘]’] [‘=’ <default>] [‘{‘ <prop-modifier > [‘,’ <prop-modifier >]* ’}’]
[ details omitted ]
在此上下文中不再相关,但无论如何保留它:
回复。 @granier 关于标记值的评论:事实上,UML 2.5 不再真正使用标记值。只有 3 次提到它:
主要是 p. 205
Just like a Class, a Stereotype may have Properties, which have traditionally been referred to as Tag Definitions. When a Stereotype is applied to a model element, the values of the Properties have traditionally been referred to as tagged values.
所以tagged value是一个“古老”的术语,应该进一步称为stereotype property。
关于java - UML 图 - 如何显示 FINAL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47588511/