Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [XPand] Supporting @generated style protection
[XPand] Supporting @generated style protection [message #641508] Thu, 25 November 2010 12:59 Go to next message
Miles Parker is currently offline Miles Parker
Messages: 1338
Registered: July 2009
Senior Member
I think this has come up before (maybe on older oAW forums) but I've been talking with new contributors and they'd like to have support for the @generated pattern ala Jet. That is one pattern from Jet that I do wish it were possible to do in XPand.

Since XPand is not targeting Java per se I don't see how there could be built-in support for that, but we're wondering if people have ideas for how it might be accomplished. I can't really think of anything since the only way to do protected regions is to have a begin and end marker. Has anyone else thought about this or are there ideas for supporting it in XPand somehow?

As an aside, my own opinion is that it is not necessarily needed. I am using the protected regions now and I find it sort of awkward to maintain such code myself and I imagine that is the case for users as well. But personally I'm not a big fan of annotations, and have been moving much more toward a provider centric model where the code is very discrete and fine-granined. That way you can simply mark an entire element in the model (not the code) for non-generation and people can then protect and edit the whole class document. But I can definitely see the arguments for it, the most important being that people who are using EMF, etc.. are very used to it and it is really transparent.

Re: [XPand] Supporting @generated style protection [message #641511 is a reply to message #641508] Thu, 25 November 2010 13:18 Go to previous messageGo to next message
Miles Parker is currently offline Miles Parker
Messages: 1338
Registered: July 2009
Senior Member
Miles Parker wrote on Thu, 25 November 2010 12:59
I think this has come up before (maybe on older oAW forums) but I've been talking with new contributors and they'd like to have support for the @generated pattern ala Jet.



As I was writing a response to amp-dev about this, I realized one way that this could be done, but it might be expensive. You (meaning XPand team) or me (meaning implementors) could write some Java extensions that examined the annotations for the target Java class, and use those annotations to determine whether to generate the code or mix it in somehow. I guess you could then use EMF Java meta-model to load the method body from the existing code and just re-emit it. Hmm..
Re: [XPand] Supporting @generated style protection [message #641515 is a reply to message #641511] Thu, 25 November 2010 13:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25942
Registered: July 2009
Senior Member
Miles,

Note that JMerger is easily reused and is independent from JET...


Miles Parker wrote:
> Miles Parker wrote on Thu, 25 November 2010 12:59
>> I think this has come up before (maybe on older oAW forums) but I've
>> been talking with new contributors and they'd like to have support
>> for the @generated pattern ala Jet.
>
>
> As I was writing a response to amp-dev about this, I realized one way
> that this could be done, but it might be expensive. You (meaning XPand
> team) or me (meaning implementors) could write some Java extensions
> that examined the annotations for the target Java class, and use those
> annotations to determine whether to generate the code or mix it in
> somehow. I guess you could then use EMF Java meta-model to load the
> method body from the existing code and just re-emit it. Hmm..
Re: [XPand] Supporting @generated style protection [message #641525 is a reply to message #641515] Thu, 25 November 2010 14:55 Go to previous message
Miles Parker is currently offline Miles Parker
Messages: 1338
Registered: July 2009
Senior Member
Ed Merks wrote on Thu, 25 November 2010 13:33
Miles,

Note that JMerger is easily reused and is independent from JET...


Thanks Ed! I did not know that.

If anyone has done an integration with Xpand please let me know.
Previous Topic:Max / Min Operation?
Next Topic:[MWE] FileNotFoundException after exporting projects to jar
Goto Forum:
  


Current Time: Tue Jul 29 17:06:34 EDT 2014

Powered by FUDForum. Page generated in 0.01577 seconds