Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to use templates selectively
How to use templates selectively [message #534068] Mon, 17 May 2010 20:51 Go to next message
Alexey  is currently offline Alexey Friend
Messages: 36
Registered: March 2010
Member
Suppose I have two types of entities (specified e.g. with annotations): type A and type B. Code generation for entities of type A should use templates T1 and T2, while for entities of type B templates T2 and T3 should be used.

I always can check type of entity after template called, but how to tell emf that this particular template for this particular situation should be "skept", no code should be generated? What should I call on emf, or what should I return from template file (_.java)? E.g., if I return empty string from template java file, will it work for me? Should be some legal way to tell emf to skip tempalte for particular GenClass.

Thanks

Alexey
Re: How to use templates selectively [message #534075 is a reply to message #534068] Mon, 17 May 2010 21:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Alexey,

The logic of which templates to invoke is in the generator adapters.
But of course for the existing generator adapters, the logic is all
there already and beyond your direct control.


Alexey wrote:
> Suppose I have two types of entities (specified e.g. with
> annotations): type A and type B. Code generation for entities of type
> A should use templates T1 and T2, while for entities of type B
> templates T2 and T3 should be used.
>
> I always can check type of entity after template called, but how to
> tell emf that this particular template for this particular situation
> should be "skept", no code should be generated? What should I call on
> emf, or what should I return from template file (_.java)? E.g., if I
> return empty string from template java file, will it work for me?
> Should be some legal way to tell emf to skip tempalte for particular
> GenClass.
>
> Thanks
>
> Alexey


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to use templates selectively [message #534272 is a reply to message #534075] Tue, 18 May 2010 14:41 Go to previous messageGo to next message
Alexey  is currently offline Alexey Friend
Messages: 36
Registered: March 2010
Member
Ed,

Thanks for explanation.

But still, is there any way to express in template that "generator adapter" should not create java file? Any run time condition that would not result in aborting a whole code generation session, but only the current artifact from the current template?

Thaniks

Alexey
Re: How to use templates selectively [message #534337 is a reply to message #534272] Tue, 18 May 2010 17:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Alexey,

Comments below.

Alexey wrote:
> Ed,
>
> Thanks for explanation.
> But still, is there any way to express in template that "generator
> adapter" should not create java file?
No, the template specifies the text to produce given the input.
> Any run time condition that would not result in aborting a whole code
> generation session, but only the current artifact from the current
> template?
No.
>
> Thaniks
>
> Alexey


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:inherit Ecore.ecore in my ecore file
Next Topic:How to override destination location for emf
Goto Forum:
  


Current Time: Fri Apr 26 18:05:50 GMT 2024

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

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

Back to the top