UML class diagram enum

Martijn picture Martijn · Jan 5, 2009 · Viewed 223.7k times · Source

I am modeling a class diagram. An attribute of a class is an enumeration. How do I model this? Normally you do something like this:

- name : string

But how does one do this with an enum?

Answer

James B picture James B · Jan 5, 2009

They are simply showed like this:

_______________________
|   <<enumeration>>   |
|    DaysOfTheWeek    |
|_____________________|
| Sunday              |
| Monday              |
| Tuesday             |
| ...                 |
|_____________________|

And then just have an association between that and your class.