UML diagram - how to show FINAL

You show it like this.

enter image description here

Private is symbolized by a minus. The static attribute is shown by an underline. The initial value is shown by = <value>. Since I learned that final denotes a constant, you will apply the isConst property which is shown as {readOnly}.

See also p. 111 of the UML spec:

<property> ::= [<visibility>] [‘/’] <name> [‘:’ <prop-type>] [‘[‘ <multiplicity-range> ‘]’] [‘=’ <default>] [‘{‘ <prop-modifier > [‘,’ <prop-modifier >]* ’}’]

[ details omitted ]


No longer relevant in this context, but leaving it anyway:

Re. @granier's comment about tagged values: Indeed UML 2.5 does no longer really use tagged values. There are only 3 mentions of it:

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

So tagged value is an "ancient" term and should further be called stereotype property.


For an UML representation of a Java project, it should be sufficient to write underlined caps, like…

A constant in a UML class diagram

Note that this representation uses a Java convention (constants written in capitals) to highlight it as final instead of a UML annotation, which would be kind of more straight-forward UML, but is too long for my purposes.

Tags:

Java

Uml