This example shows how to create a new Java 8 application skeleton, generate the sources and edit them.

It assumes you have a Java 8 Modelio project setup. You may look for Create a basic Java 8 project to create one.

1. Create a basic model

  1. Right click on the root package.

1.1. Create a java package

  1. In the contextual menu, select Create element→standard.packagePackage.

  2. Select the created package

  3. Select the "module Java" view.

  4. Transform the UML package to a Java package with the "javapackageJava package" button.

    Note The package is then stereotyped "javapackageJavaPackage"
  5. Use the "UML Name" field to name the package "com.example".

1.2. Create the main class

  1. Right click on the created java package.

  2. In the contextual menu, select Create element→Class to create a class in the package.

    Note The class is automatically stereotyped "javaclassJavaClass"
  3. In the "module Java" view, use the "UML Name" field to name the class "MyApp".

2. Generate the sources

  1. Select the "javapackagecom.example" package

  2. Go to the "module Java" view.

  3. Click on the Generate sources button to generate the sources on the whole package.

3. Edit the class source file

  1. Select the "MyApp" class.

  2. Edit the generated source either :

    • in the integrated editor with the edit button,

    • or use your favorite IDE to open the file.