| Enum modelisation in ecore [message #431118] |
Mon, 29 June 2009 12:29  |
Eclipse User |
|
|
|
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 12:34  |
Eclipse User |
|
|
|
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
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.25380 seconds