Java code generation functions

Generating several classes within a single source file

Java source files can contain several classes. To generate several classes in the same source file, the file’s main class is linked to the other files by an element import link stereotyped as JavaFileGroup.

A Java source file containing several classes is generated in the model in the following way:

File group diagram

The file’s main class is linked to the other files by an element import link stereotyped JavaFileGroup.

Java generation commands

Modelio Java Designer generation provides several features related to generation.

Generate command

  • : The “Generate” command will generate Java code for the class.

  • : The “Edit” command will open an editor to modify the Java file content. When the editor is closed, the content of the file is automatically reversed.

  • : The “Update model” command will reverse the Java code for the class.

generate.png (608 Bytes) Frédéric Ferran, 19 April 2011 13:48

edit.png (1.33 KB) Frédéric Ferran, 19 April 2011 13:48

update.png (1.27 KB) Frédéric Ferran, 19 April 2011 13:48

filegroup.png - File group diagram (23.6 KB) Christophe Malgouyres, 09 August 2011 14:19

fig72_mod.gif - Generate command (56.2 KB) Christophe Malgouyres, 19 August 2011 11:33