Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Setting a default implementation for methods
Setting a default implementation for methods [message #1773466] Thu, 28 September 2017 09:01 Go to next message
Martin Hensin is currently offline Martin HensinFriend
Messages: 1
Registered: September 2017
Junior Member
Hello everyone,

I have made an Ecore for a java project and I have created a "genmodel" file from the Ecore and could generate all java classes from it. The problem that I would have a default implementation "Java code" for some methodes, so that by every changing in my Ecore-file I have not to write the implementation again after a new classes generation.

Any suggest?

Thanks alot!
Re: Setting a default implementation for methods [message #1773510 is a reply to message #1773466] Thu, 28 September 2017 17:52 Go to previous messageGo to next message
Pavel Vlasov is currently offline Pavel VlasovFriend
Messages: 23
Registered: December 2015
Junior Member
It is possible with model annotations, but I don't remember details.
Re: Setting a default implementation for methods [message #1774297 is a reply to message #1773510] Thu, 12 October 2017 14:01 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29327
Registered: July 2009
Senior Member
Sorry, I wasn't seeing posts because of https://bugs.eclipse.org/bugs/show_bug.cgi?id=525901

You can do it like this:
    <eOperations name="foo">
      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
        <details key="body" value="// &lt;%java.util.Map$Entry%> "/>
      </eAnnotations>
    </eOperations>

The body can be any valid Java and you can use <%a.b.C$D%> to import names...
Previous Topic:Application Model Editor - Handled Menu Item Icons
Next Topic:How to get annotations of enum literals at runtime?
Goto Forum:
  


Current Time: Tue Apr 24 23:25:48 GMT 2018

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

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