Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » CDI annotations - customize generated code
CDI annotations - customize generated code [message #1626999] Sat, 21 February 2015 08:48 Go to next message
Anton Hughes is currently offline Anton HughesFriend
Messages: 66
Registered: January 2013
Member
Hi

I have searched this forum, many times, and googled - trying to find how to add annotations.

I have seen various posts saying how easy it is to customize the generated code using annotations - but cannot find any information on how to add annotations - as in, in the generated java.

For those of use who want to annotate our classes - say, for use in CDI, with scopes, qualifiers etc, how can we do this?

Thanks

[Updated on: Sat, 21 February 2015 10:21]

Report message to a moderator

Re: CDI annotations - customize generated code [message #1627956 is a reply to message #1626999] Sat, 21 February 2015 21:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Anton,

Depending on which editor you use the process for creating annotations
is can be different. I assume you're referring to EAnnotations on your
Ecore model, right? In the Sample Ecore Editor, you can create an
EAnnotation from the context menu and details for that annotation also
via the context menu.

On 21.02.2015 09:48, Anton Hughes wrote:
> Hi
>
> I have searched this forum, many times, and googled - trying to find how
> to add annotations.
>
> I have seen various posts saying how easy it is to customize the
> generated code using annotations - but cannot find any information on
> adding annotations.
> For those of use who want to annotate our classes - say, for use in CDI,
> with scopes, qualifiers etc, how can we do this?
>
> Thanks


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: CDI annotations - customize generated code [message #1628470 is a reply to message #1627956] Sun, 22 February 2015 04:48 Go to previous messageGo to next message
Anton Hughes is currently offline Anton HughesFriend
Messages: 66
Registered: January 2013
Member
Thanks Ed

So, it is possible to add annotations to classes and methods?

For example

@MyCustomAnnotation
MyClass {

   @MyMethodAnnotation
   public void myMethod(){
   }

}


Can you confirm it is possible to do this using EAnnotations?
Re: CDI annotations - customize generated code [message #1632069 is a reply to message #1628470] Tue, 24 February 2015 04:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Anton,

No, EAnnotations don't directly generate Java annotations. One would
need to specialize the templates for that. I'm not sure if there are
include points for annotations and I don't have a full development
environment available until next week to answer in more detail.


On 22.02.2015 05:48, Anton Hughes wrote:
> Thanks Ed
>
> So, it is possible to add annotations to classes and methods?
>
> For example
>
>
> @MyCustomAnnotation
> MyClass {
>
> @MyMethodAnnotation
> public void myMethod(){
> }
>
> }
>
>
> Can you confirm it is possible to do this using EAnnotations?


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[EMF Transaction] Transaction.getChangeDescription()
Next Topic:[EMF] Generation Gap EcoreGenerator
Goto Forum:
  


Current Time: Thu Apr 25 22:47:31 GMT 2024

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

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

Back to the top