Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Ecore, passing annotations information to implementation classes
Ecore, passing annotations information to implementation classes [message #530577] Fri, 30 April 2010 08:29 Go to next message
e1n is currently offline e1nFriend
Messages: 22
Registered: April 2010
Location: Poland
Junior Member

Hi !

I have following problem:

I have crated ecore model using ecore diagram tool and genereted corresponding .genmodel .
Using this file i have genereted model calsses and their implementation.
I have also overriden the emf code generation JET templates (I am modifying existing ones).

In my ecore model i have Class called Notification which i have passed
some EAnnotation information as you can see in picture below:

http://expressdruk.pl/emf/ecore_model.png

To get to information I have passed to Notification class. I have modified Class.javajet template. My modification gets information about passed EAnnotation through genClass.getModelInfo() call and parses this information to remember Annotation name and parameters.

The problem is that getClass.getModelInfo() call gets information about
annotation only for Notification which is java Interface. I can not fetch this information in NotificationImpl class while I am generating model code.

http://expressdruk.pl/emf/generated_model.jpg


How can I solve this problem ?

I will be very grateful for any tip or piece of advice .

e1n

[Updated on: Fri, 30 April 2010 08:30]

Report message to a moderator

Re: Ecore, passing annotations information to implementation classes [message #530620 is a reply to message #530577] Fri, 30 April 2010 10:22 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
e1n,

Comments below.

e1n wrote:
> Hi !
>
> I have following problem:
>
> I have crated ecore model using ecore diagram tool and genereted
> corresponding .genmodel .
> Using this file i have genereted model calsses and their implementation.
> I have also overriden the emf code generation JET templates (I am
> modifying existing ones).
>
> In my ecore model i have Class called Notification which i have passed
> some EAnnotation information as you can see in picture below:
>
> http://expressdruk.pl/emf/ecore_model.png
>
> To get to information I have passed to Notification class. I have
> modified Class.javajet template. My modification gets information
> about passed EAnnotation through genClass.getModelInfo() call and
> parses this information to remember Annotation name and parameters.
>
> The problem is that getClass.getModelInfo() call gets information about
> annotation only for Notification which is java Interface. I can not
> fetch this information in NotificationImpl class while I am generating
> model code.
>
>
>
>
> How can I solve this problem ?
You can use genClass.getEcoreClass() to access the Ecore model directly
and then use the Ecore API to access the EAnnotations, or helpful
utilities like EcoreUtil.getAnnotation.
>
> I will be very grateful for any tip or piece of advice .
>
> e1n
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Schema evolution: reference to attribute
Next Topic:[CDO] Mapping from CODObject to CDOClass
Goto Forum:
  


Current Time: Thu Apr 25 11:12:46 GMT 2024

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

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

Back to the top