Attributes
Details of a class (the color of a car, the number of sides in a shape, etc.) are represented as attributes . Attributes can be simple primitive types (integers, floating-point numbers, etc.) or relationships to other, complex objects (see "Relationships").
An attribute can be shown using two different notations: inlined or relationships between classes. In addition, notation is available to show such things as multiplicity, uniqueness, and ordering. This section introduces both notations, and then describes the details of the attribute specification.
Inlined Attributes
You can list a class's attributes right in rectangle notation; these are typically called inlined attributes . There is no semantic difference between inlined attributes and attributes by relationship; it's simply a matter of how much detail you want to present (or, in the case of primitives like integers, how much detail you can present).
To represent an attribute within the body of a class, place the attribute in the second compartment of the class. UML refers to inlined attributes as attribute notation . Inlined attributes use the following notation:
visibility
/name
:type
multiplicity
=default
{property strings and constraints
} visibility ::= {+|-|#|~} multiplicity ::= [lower
..upper
]
Figure 2-3 lists several attributes, demonstrating various aspects of attribute notation.
Figure 2-3. Example ...
Get UML 2.0 in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.