I would use the new JET2 syntax. You must create a new JET transform using New -> Other.
As for what happens at a high level, you will have a template named main.jet that will act as a controller. It does not create any textual content, but it will manage the generation of projects, folders and files.
I understand that you want to use the class object as input, but I recommend that you create your own templates for using an XML file as input. Something like that:
<root> <object name="A"> <method name="m1" returns="void"> <arg name="x" type="int" /> <arg name="y" type="int" /> </method> <method name="m2" returns="int"> <arg name="a" type="Object" /> </method> <method name="m3" returns="Object"> </method> </object> </root>
You can see that given the class, we can "easily" create such an XML document.
So main.jet will look something like this:
<%@taglib prefix="ws" id="org.eclipse.jet.workspaceTags" %> <c:iterate select="/root/object" var="object" <c:set select="$object" name="impl" ><c:get select="$object/@name"/>Implementation</c:set> <c:set select="$object" name="interface" ><c:get select="$object/@name"/></c:set> </c:iterate> <c:iterate select="/root/object" var="object"> <ws:file path="my project/src/a/b/c/{$object/@interface}.java" template="interface.jet" /> <ws:file path="my project/src/a/b/c/{$object/@impl}.java" template="impl.jet" /> </c:iterate>
Basically, you iterate over each object (you can define as many as you want), and you build the implementation and interface names and save those names back to the model.
After you have completed all the naming conventions, you iterate over the elements of the object and apply the templates to the model using the ws: file tag. The tag indicates which template to use, and then indicates the file name to create with the generation results.
The interface.jet file might look something like this:
package abc; interface <c:get select="$object/@interface"/> { <c:iterate select="$object/method" var="method" > <c:get select="$method/@returns"/> <c:get select="$method/@name"/>(int x, int y); </c:iterate> }
Please note that I hardcoded the package as abc. You can make this variable by adding an attribute to the XML file, possibly to the element of the object and using the c: get tag to paste it into the source code. I also left the arguments hardcoded, but you can use another iterate tag to iterate over the nested elements of the model to record the method signature.
So, I will dwell on this to make sure that this is what you were looking for. You can ask more comments or ask more questions.