This page covers topics that are common to all JavaGen modules. The remaining pages are dedicated to module-specific features.
The JavaGen code generator is composed of specific modules that can be turned on or off depending on the type of application you're developing. You activate a module with switches that are simply Ant properties, for example:
<property name="javagen.sql.flag" value="true"/>
turns on the SQL module which generates SQL script to create and drop tables for your data model.
Java exceptions are indicated by the <<exception>> stereotype. Usually an empty class with this stereotype is sufficient to create a usable class. You can use inheritance and add methods and properties to further customize exception classes.
JavaGen generates logging statements sparingly at key points in the work-flow of the application. You can specify the logging API to use or suppress logging altogether by setting the following property:
| Property | Default | Description |
|---|---|---|
| javagen.logging |
log4j
| Valid settings are: log4j, commons, java, println or none |
One of JavaGen's more advanced capabilities is model-to-model transformations. Manipulating your model before it is processed by more specialized modules greatly increases the expressive power of UML. Transformations are specified using UML dependencies labeled with JavaGen-specific stereotypes.
| Stereotype | Description |
|---|---|
| <<gen-copy>> | Copies all attributes from target to the source class. |
| <<gen-interface>> | Generates abstract methods for all public methods in target class. |
| <<gen-crud>> | Generates Create, Read, Update and Delete methods depending on context. |
It is also possible to chain transformations, saving a lot of work by
propagating attributes from one tier to the next. For example, this diagram copies the Account
attributes from the entity tier to the service tier to the client tier:

Model-to-model transformations occur in discrete stages or passes. By default these transformations
occur in the first pass, but you can override this by attaching a pass Tagged Value to
a UML dependency. For example, in the diagram above the second <<gen-copy>> dependency
(from AccountForm to AccountVO is set as follows:

Thus delaying this copy transformation to the second pass, after AccountVO has been populated
with attributes from the first pass.
The JavaGen Community Edition supports up to two transformation stages.
TODO: explain transformations on attribute subsets.