Enum in a ClassDiagramm?

Hello,

I am from germany and my english is not sogood, but I hope somebody unterstand and can help me.

My Problem. I want to paint a class diagramm for a enum class that generates thid java Code.

public enum state
{
init,
run,
stopped,
deleted,
end;
}

In the diagramm I have create a class with the stereotyp , but I don’t know how I get the states in this class. When I try to create an attribut for any state, the java class looks like this. And that is false.

public enum state
{
public Object init;
public enum run;

}

What must I do, to get the code at the begin of the thred,when I use the Instant generator?

So ich schreibs auch nochmal auf deutsch, falls es jemand liest, der das besser versteht.
Ich möchte in einem Klassendiagramm ein enum anlegen für bestimmte Statuse, anschließend möchte ich aus dem Diagramm Code generieren.
So soll der Code dann aussehen
public enum state
{
init,
run,
stopped,
deleted,
end;
}

Ich habe dafür eine Klasse angelegt und der den Stereotyp enum zugeordnet. Jetzt wird die Klasse auch als enum angelegt. Nur weiß ich nicht wie ich die einzelnen Stastue (z.B. init im Diagramm angebe) habe sie einfach alle als public Attribt ohne Typ angelegt. das hat aber nicht funktioniert und es kam bei der Generierung das heraus.

public enum state
{
public Object init;
public enum run;

}

Wie füge ich die Einträge richtig hinzu?

Hi schuetzejanett,

Instead of adding attribute, you should add enumeration literal. Enumeration literal is in fact an attribute, but stereotyped as “Constant”.

Best regards,
Jick

generateEnumLiteral.png

Hello,

Thanks for your Answer.
I try what you tell me, but in my program. There is no item(enumeration literal) in the kontextmenu) It looks like in this image.
I works with the professional edition and the version 6.0 (sp2_20070511).
What can be the reason, of that

http://www.imgwelt.de/uploads/E8E21GL5NMT.jpg

Hello,

Thanks for your Answer.
I try what you tell me, but in my program. There is no item(enumeration literal) in the kontextmenu) It looks like in this image.
I works with the professional edition and the version 6.0 (sp2_20070511).
What can be the reason, of that

http://www.imgwelt.de/uploads/E8E21GL5NMT.jpg

sorry for double posting, one post can be deleted

Hi schuetzejanett,

The build that you are using is not new enough to have the popup menu. Yet, you can manually create attribute and stereotype them as “Constant”. Of course, the best solution is to upgrade your release to the latest one. You can run the updater inside the bin folder of VP Suite installation directory.

On another note, VP Suite 3.1 has been released. You can also download and have a try.

Download page:
http://www.visual-paradigm.com/download/

Best regards,
Jick

Thanks, now it works

My pleasure! :smiley: :smiley: