The designed classes can be modified from Groovy scripts.
Here is an example of how to generate a version attribute
with a @Version tag in all <<Persistent>> classes:

@javax.persistence.Version
public int getVersion() {
return this.version;
}To modify classes of a specific stereotype, download the corresponding file, copy it into your project root directory and modify it as desired:
| Stereotype | Groovy Script |
DAO |
DAOClassBuilder.groovy |
Java Bean |
JavaBeanClassBuilder.groovy |
Persistent |
PersistentClassBuilder.groovy |
Persistent Test |
PersistentTestClassBuilder.groovy |
Unit Test |
UnitTestClassBuilder.groovy |
GWT Service |
GWTServiceClassBuilder.groovy |
When you update the script, you can see the changes immediately in the class diagram. Then, save the diagram to regenerate the Java code.
The script has a two methods build and clear
that are called as follows:
build is called.
clear in the old script is called first,
and then build in the new script.
clear is called.
build method is modified,
build is called immediately.
For instance, if build calls
findVariablesWithStereotype(...),
c.getName(), or in Groovy syntax c.name,
it will be called again if the output of those method changes.