Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Enum modelisation in ecore
Enum modelisation in ecore [message #431118] Mon, 29 June 2009 16:29 Go to next message
David Michonneau is currently offline David MichonneauFriend
Messages: 85
Registered: July 2009
Member
Hi,

I would like to model an enum with a different pattern than the one provided
by default. My Java classes should look like this:


public enum Type
{
TYPEA(1);
TYPEB(2);
....
int getValue();
}


public enum MyEnum
{
VALUE1(1, Type.TYPEA);
VALUE2(2, Type.TYPEB);
...
VALUEN(N, Type.TYPEA);

public int getValue();
public Type getType();

}

How should I model my ecore to generate this code?

Thanks,

David
Re: Enum modelisation in ecore [message #431121 is a reply to message #431118] Mon, 29 June 2009 16:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30692
Registered: July 2009
Senior Member
David,

Comments below.

David Michonneau wrote:
> Hi,
>
> I would like to model an enum with a different pattern than the one provided
> by default. My Java classes should look like this:
>
>
> public enum Type
> {
> TYPEA(1);
> TYPEB(2);
> ...
> int getValue();
> }
>
>
Why isn't the existing get value good enough?
> public enum MyEnum
> {
> VALUE1(1, Type.TYPEA);
> VALUE2(2, Type.TYPEB);
> ...
> VALUEN(N, Type.TYPEA);
>
> public int getValue();
> public Type getType();
>
> }
>
> How should I model my ecore to generate this code?
>
EMF's just not going to generate this second thing. You can hand modify
what's generated to achieve that.
> Thanks,
>
> David
>
>
>
Previous Topic:EMap
Next Topic:problem with prefix
Goto Forum:
  


Current Time: Sat Dec 14 11:11:19 GMT 2019

Powered by FUDForum. Page generated in 0.02475 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top