Enumerations

In UML models, enumerations are model elements in class diagrams that represent user-defined data types. Enumerations contain sets of named identifiers that represent the values of the enumeration. These values are called enumeration literals.

You can add enumerations to models that represent software systems to depict discrete sets of values. Enumerations can represent primitive types, such as Integer and Boolean types, or user-defined types.

An enumeration has a name that describes its role in a model. The diagram editor displays an enumeration as a rectangle with two compartments:

Image shows an enumeration called Boolean in UML notation with the enumeration literals compartment visible.  The enumerations compartment contains two enumeration literals with public visibility: one called true and the other called false.

Example

Your models can include user-defined enumerations such as one that defines the days of the week. For example, an enumeration called Day has enumeration literals of Monday, Tuesday, Wednesday, and so on.

You can also model the primitive data types in many programming languages. For example, the Boolean data type has enumeration literals of true and false.

Parent topic: Class diagrams

Related tasks
Adding enumeration literals to enumerations
Sorting and filtering enumeration literals

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.