Generating Program Code
After you design the model of your application in UModel (for example, one or more class diagrams), you might want to quickly generate a prototype project which includes all defined interfaces, classes, operations, and so on, in your language of choice. UModel enables you to generate C#, VB.NET, or Java program code from a model, based on UML elements found in your UModel project (such as interfaces, classes, operations, and so on). This process is also known as "forward engineering". The generated code will create all objects exactly as they were defined in the model, so that you can proceed to their actual implementation.
Code generation is also applicable to XML schemas and databases*. For example, you could design an XML schema or a database with UModel and then generate the corresponding file (or SQL script, in case of databases) from the model. To achieve this, consult the mapping tables to find out which schema or database elements map to UModel elements, see UModel Element Mappings.
* Engineering databases requires UModel Enterprise or Professional editions.
In order for code generation to be possible, the UModel project must meet the following minimum requirements:
•One of the packages in your project must be designated as namespace root. The namespace root can be a C#, Java, VB.NET, XSD, or Database namespace. This package must contain all classes and interfaces from which code is to be generated. For more information, see Setting a Package as Namespace Root.
•A code engineering component must be added to the project. This component must be realized by all the classes or interfaces from which code is to be generated. For more information, see Adding a Code Engineering Component. .
In addition to this, it is recommended that you include one of the built-in UModel subprojects corresponding to the language (or the language version) you want to use, see Including Subprojects. For example, if your application must target a specific version of C#, Java, or VB.NET, this would enable you to use the corresponding data types while designing your UML classes, interfaces, and so on.
For a worked example of how to create a project from scratch and generate code from it, see Example: Generate Java Code.