views:

7938

answers:

4

Hi

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 to do this with an enum?

Thnx in advance :)

+1  A: 

Typically you model the enum itself as a class with the enum stereotype

annakata
+14  A: 

They are simply showed like this:

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

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

James Burgess
Thnx, i get it :)
Martijn
+5  A: 
adilei
Thnx, but do i have to connect the enum to my class? I saw some examples where the used composite and other didn't draw a line at all. In my case the enum is used public in one class
Martijn
You should associate it, otherwise it has little meaning in and of itself.
James Burgess
James is right, you should associate it with your class.
adilei
A: 

Do the enum members to have be written underlined since there are static definitions?