|
Re: parameter passing pattern for templates [message #531431 is a reply to message #531383] |
Tue, 04 May 2010 20:36 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Alexey,
If you look elsewhere in the template you can see
<%final boolean isInterface =
Boolean.TRUE.equals(((Object[])argument)[1]); final boolean
isImplementation = Boolean.TRUE.equals<(((Object[])argument)[2]);%>
The point is that we merged the Interface.javajet and Class.javajet
templates into a single template so that it would be possible to
generate separate interface and implementation classes or to generate
just a single merged result. Additional template arguments were needed
to control that. So rather than just passing a GenClass, we needed to
pass in some Booleans.
Alexey wrote:
> I found one feature of emf that I would like to share (advanced emf
> inhabitants probably familiar with that). The parameter passing
> pattern for Class.javajet and for some other templates, e.g.
> ItemProvide.javajet or org.eclipse.emf.examples.generator.validator -
> those patterns are different.
>
> In Class.javajet we have: GenClass genClass =
> (GenClass)((Object[])argument)[0];
> For many others:
> GenClass genClass = (GenClass)argument;
>
> And naturally using Class pattern in your own templates results in
> ClassCastException...
>
> So, Ed (if it will be you), can you please comment on those
> differences, on design intentions? Is there something else important
> to know here for those who build their own templates for emf? Is this
> described anywhere, or only in code?
>
> Thanks
>
> Alexey
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02531 seconds