Record and Extensible Enumerations

Let’s learn about record and extensible enumerations.

We'll cover the following

Record enumerations

A record enumeration defines a record type with a unique field designated to provide the enumeration literals and a fixed list of records of that type. In general, a record type is defined by a set of field definitions in the form of primitive datatype attributes, such that one of the unique fields is defined as the enumeration literal field and a set of operation definitions.

Unfortunately, record enumerations, as the most general form of an enumeration datatype, are not supported by the current version of UML (2.5), where the general form of an enumeration is defined as a special kind of the datatype, with optional field and operation definitions, having an additional list of unique strings as enumeration literals (shown in a fourth compartment). The UML definition neither allows designating one of the unique fields as the enumeration literal field nor does it allow populating an enumeration with records.

Consequently, we need to find a workaround to show a record enumeration in a UML class diagram. For instance, if our modeling tool allows adding a drawing, we could draw a rectangle with four compartments, such that the first three of them correspond to the name, properties, and operations compartments of a datatype rectangle. The fourth compartment is a table with the names of properties/fields defined in the second compartment as column headers, as shown in the following figure.

Get hands-on with 1200+ tech skills courses.