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
-
Right click on the root package.
1.1. Create a java package
-
In the contextual menu, select Create element→
Package.
-
Select the created package
-
Select the "
Java" view.
-
Transform the UML package to a Java package with the "
Java package" button.
The package is then stereotyped " JavaPackage"
-
Use the "UML Name" field to name the package "com.example".
1.2. Create the main class
-
Right click on the created java package.
-
In the contextual menu, select Create element→Class to create a class in the package.
The class is automatically stereotyped " JavaClass"
-
In the "
Java" view, use the "UML Name" field to name the class "MyApp".
2. Generate the sources
-
Select the "
com.example" package
-
Go to the "
Java" view.
-
Click on the
button to generate the sources on the whole package.
3. Edit the class source file
-
Select the "MyApp" class.
-
Edit the generated source either :
-
in the integrated editor with the
button,
-
or use your favorite IDE to open the file.
-