Generics in generator template


in the generator I want to create an interface root template, which uses generics in method headers. The generated Java code of the method should look something like this:

<C extends SomeJavaClass> void doSomething(C someParameter);

I struggle to get the

<C extends SomeJavaClass>

part into the template. Is there a way to do this? Or should I try to use a different approach?


Thanks in advance.

Comment actions Permalink

Ok... usually you would be able to accomplish this. But sometimes, it is hard to use the editors accordingly:

  1. Open the sample Project crossModelGeneration
  2. Go to the root mapping rule in the generator of Entities language:
  3. Add a new root mapping rule for Entity
  4. Use an interface to create the template
  5. In the freshly created root mapping add a method declaration to the interface.
  6. On the method name ALT+Enter choose: add Type Variable
  7. Type in C,  "space", "extends", the class name you want. 


Comment actions Permalink

That's it. Thanks a lot.


Please sign in to leave a comment.