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 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. As the following figure illustrates, the diagram editor displays an enumeration as a rectangle with two compartments:

An enumeration called Boolean contains two public enumeration literals.

Example

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 that are available in many programming languages. For example, the Boolean data type has enumeration literals of true and false.


Feedback