Ecore, passing annotations information to implementation classes [message #530577] |
Fri, 30 April 2010 08:29 |
|
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:
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 ?
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 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.02610 seconds