Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » enumeration modeling issue.
enumeration modeling issue. [message #428736] Sat, 28 March 2009 11:36 Go to next message
Jorge Dieguez is currently offline Jorge DieguezFriend
Messages: 48
Registered: July 2009
Location: France
Member

Hello team,

Because of repetitive error at generation time, I have down graded an
example on enumeration -coming on the EMF book, to the simplest annotation
and still I'm getting the same error. (.genmodel phase seems to be ok)

Here is the annotation on Enumerated type:

/**
* @model
*/
public class EnnumClass {
/**
* @model
*/
public static final int PENDING = 1;
}

this results in error: "Duplicate field EnummClass.PENDING" in:

EnnumClass.java:(bellow)

public static final int PENDING = 1; and in three other instances of
EnnumClass.PENDING in the same file.

This also result in error: "EnummClass.PENDING cannot be resolved" in:

EnnumPackageImpl.java:(bellow)

public void initializePackageContents() {
...
addEEnumLiteral(ennumClassEEnum, EnnumClass.PENDING);
...
}

My question is:

Is this due to some "newbie innocent mistake" or it's that I have some
installation, plugin update, or platform issue on my own EMF-Eclipse
environment? I may have done a bad installation???

Coincidentally, I have experienced some inconsistencies trying to emulate
books examples that lead me to believe the latest opinion. Example.

Data type attribute: (simple annotated interface with a data type
attribute)

Date getDate(); it should generate in the implementation factory:

public String convertDateToString(...){} and,
public Date createDateFromString(...){} however I didn't succeed to see
these methods in neither the interface nor the class implementation.

I would sincerally appreciate your support.

Jorge


Jorge
Re: enumeration modeling issue. [message #428741 is a reply to message #428736] Sat, 28 March 2009 13:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070703090209040308010806
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Jorge,

Comments below.

Jorge Dieguez wrote:
> Hello team,
>
> Because of repetitive error at generation time, I have down graded an
> example on enumeration -coming on the EMF book, to the simplest
> annotation and still I'm getting the same error. (.genmodel phase
> seems to be ok)
>
> Here is the annotation on Enumerated type:
>
> /**
> * @model
> */
> public class EnnumClass {
> /**
> * @model
> */
> public static final int PENDING = 1;
> }
>
> this results in error: "Duplicate field EnummClass.PENDING" in:
> EnnumClass.java:(bellow)
>
> public static final int PENDING = 1; and in three other instances of
> EnnumClass.PENDING in the same file.
>
> This also result in error: "EnummClass.PENDING cannot be resolved" in:
>
> EnnumPackageImpl.java:(bellow)
>
> public void initializePackageContents() {
> ... addEEnumLiteral(ennumClassEEnum, EnnumClass.PENDING);
> ...
> }
>
> My question is:
>
> Is this due to some "newbie innocent mistake" or it's that I have some
> installation, plugin update, or platform issue on my own EMF-Eclipse
> environment? I may have done a bad installation???
Well, I do get one problem with this, and that's a duplicate of
PENDING. The reason for this is that if you're generating Java 5.0
(which you can control in the Compliance Level property of the GenModel)
you end up with a real Java 5.0 enum, not a class. Normally EMF can
convert from the old form to the new form, but the one glitch here is
that the sweep rules to clean up old things apply only to things marked
@generated and your PENDING constant isn't marked that way so it can't
be swept away. You'll need to delete it manually.

A proper starting point for Java 5.0 would have been like this:

/**
* @model
*/
public enum EnnumClass
{
/**
* @model
*/
PENDING;
}


>
> Coincidentally, I have experienced some inconsistencies trying to
> emulate books examples that lead me to believe the latest opinion.
> Example.
> Data type attribute: (simple annotated interface with a data type
> attribute)
>
> Date getDate(); it should generate in the implementation factory:
>
> public String convertDateToString(...){} and,
> public Date createDateFromString(...){} however I didn't succeed to
> see these methods in neither the interface nor the class implementation.
Generally a data type from EcorePackage will be used if one exists
there, i.e., EDate, unless you specify the data type is from your own
package.
>
> I would sincerally appreciate your support.
Anytime.
>
> Jorge
>

--------------070703090209040308010806
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jorge,<br>
<br>
Comments below.<br>
<br>
Jorge Dieguez wrote:
<blockquote
cite="mid:2309b3046c3c006dc2b4218487e8dbb0$1@www.eclipse.org"
type="cite">Hello team,
<br>
<br>
Because of repetitive error at generation time, I have down graded an
example on enumeration -coming on the EMF book, to the simplest
annotation and still I'm getting the same error. (.genmodel phase seems
to be ok)
<br>
<br>
Here is the annotation on Enumerated type:
<br>
<br>
/**
<br>
* @model
<br>
*/
<br>
public class EnnumClass {
<br>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: enumeration modeling issue. [message #428742 is a reply to message #428741] Sat, 28 March 2009 14:55 Go to previous message
Jorge Dieguez is currently offline Jorge DieguezFriend
Messages: 48
Registered: July 2009
Location: France
Member

Ed, Many thanks for your expedite help.

J


Jorge
Previous Topic:no remove notifications for changeable volatile list
Next Topic:[CDO] Simple example of RCP-App with client and server inside does not work
Goto Forum:
  


Current Time: Fri Apr 26 17:16:00 GMT 2024

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

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

Back to the top