Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Best place for utility code in jet templates
Best place for utility code in jet templates [message #420574] Wed, 02 July 2008 13:20 Go to next message
gary s thompson is currently offline gary s thompsonFriend
Messages: 92
Registered: July 2009
Member
Dear All


What strategies do people use to hide utility code away in JET templates?

Here is one. Currency I am overriding header.javajetinc and creating an
instance of a utility class defined there. However this seems hacky and
fragile as there is no guarantee that the header file will be included in
the same method as later parts of the template are called in (and I
believe this is the case as I had to make my util variable final to make
it globally visible). Further more an instance needs to be created and you
can't use imports and static methods... so this is a bit messy.

My other approach would be to define the utility classes compile them and
then put them on the classpath of the .JETEmitters project. However, it is
not clear how to do this (at least not to me)


regards
gary
Re: Best place for utility code in jet templates [message #420582 is a reply to message #420574] Wed, 02 July 2008 17:01 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Gary,

Comments below.

gary thompson wrote:
> Dear All
>
>
> What strategies do people use to hide utility code away in JET templates?
Don't put them in the templates. :-P
> Here is one. Currency I am overriding header.javajetinc and creating
> an instance of a utility class defined there. However this seems hacky
> and fragile as there is no guarantee that the header file will be
> included in the same method as later parts of the template are called
> in (and I believe this is the case as I had to make my util variable
> final to make it globally visible). Further more an instance needs to
> be created and you can't use imports and static methods... so this is
> a bit messy.
Yes, JET is not so easily extensible. Some will argue that Xpand is
nicer...
>
> My other approach would be to define the utility classes compile them
> and then put them on the classpath of the .JETEmitters project.
> However, it is not clear how to do this (at least not to me)
This would be cleaner. The "Template Plugin Variables" property of the
GenModel could be used to specify these additional plugin dependencies
for the .JETEmitters project; you might have to delete that project for
them to take effect...
>
>
> regards
> gary
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:unable to load XXXResourceFactoryImpl
Next Topic:RAPify emf applications
Goto Forum:
  


Current Time: Fri Apr 26 00:53:50 GMT 2024

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

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

Back to the top