How is an attribute with initial value (such as a static constant) represented in UML?
public class Foo {
public static final int BAR = 17;
}
In domain modeling class diagrams, an attribute represents a data definition for an instance of a classifier. An attribute describes a range of values for that data definition. A classifier can have any number of attributes or none at all. Attributes describe the structure and value of an instance of a class.
UML provides mechanisms to represent class members, such as attributes and methods, and additional information about them like constructors.
In UML models, attributes represent the information, data, or properties that belong to instances of a classifier. A classifier can have any number of attributes or none at all. Attributes describe a value or a range of values that instances of the classifier can hold.
The initial value of an attribute in a UML class diagram is represented just like variable assignment in a language like Java.
Moreover, since the example attribute is static, it should be underlined. Capitalization is by language or other convention and is not a UML specification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With