Let's take a look in the "model-page" page element.
If you add the "model-page" tag the XML file, a wizard-page like this will open:
So you can selected one or more POJO's. And the code generation will run to all of them.
You just have to create two files: model.xml (wizard configuration file), model.vm (Velocity template)
Create the model.xml file:
<?xml version="1.0" encoding="UTF-8"?> <EclipseWork> <wizard> <title>HelloWorld EclipseWork</title> <model-page type="java" required="true"> <description>Select some POJO</description> </model-page> <component-page > <description>Some description here</description> <container name="folder" label="Folder Output: " type="folder" /> </component-page> <output> <template component="." expression="${model.name}" velocity="model.vm" extension="txt" container="folder" /> </output> </wizard> </EclipseWork>
Create the model.vm Template:
$pojo $pojo.name $pojo.fullyName ----------------------- #foreach($f in $pojo.fields) $f.name $f.type #end
The velocity template just prints all the properties of the selected POJO.
The wizard will create two files: Pessoa.txt and Grupo.txt. Because I've selected this two POJO's
Note that you can create entire CRUD applications for your Domain Model in few minutes.