Attributes

In Unified Modeling Language (UML) 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.

For example, a Client class might have a balance attribute that holds the amount of money in the client's account.

In UML class diagrams, Java™ fields map to attributes.

Attributes are shown in the attribute compartment of a shape. Attributes that are defined in the scope of the class, that is static, are shown as underlined. The visibility styles of attributes can be represented as text symbols (such as "-") or icons (such as Image showing an attribute visibility style icon.).

The following figures illustrates how attributes are represented with visibility icons in class diagrams.

Java source code UML visualization
The image shows the sample Java source code. The image shows how attributes (fields) of a Java class are represented in UML class diagrams.
Related concepts
Operations
Visibility attributes in UML diagrams
Related tasks
Setting the default for showing operation signatures
Changing the default for showing attribute and operation compartments
Changing the default visibility style for attributes and operations
Showing associations as attributes
Showing Java attributes as associations in UML class diagrams
Showing Java attributes of collection type as associations in UML class diagrams
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.