The Java code roundtrip is a plug-out directly written in C++.
The Java code roundtrip updates from sources the classes of the model, add missing ones and remove useless classes (after confirmation).
The behavior of the Java code roundtrip plug-out depends on the kind of the element it is applied :
applied on a class it updates this classe and nested classes, the other classes may be defined in the same file (having the same associated artifact) are not updated nor the artifact. The plug-out can't be applied on a nested class
applied on an artifact it updates the artifact and all the associated classes, and add classes newly defined in the associated source file
applied on a class view it updates all the classes of the view and their nested classes, the other classes may be defined in the corresponding files (associated to the same artifacts) are not updated nor the artifacts
applied on a deployment view it updates all the artifacts in the view and their associated classes, and add classes newly defined in the associated source files
applied on a package it updates all the artifacts and classes defined under this packages and sub packages, and all the classes associated to the artifacts defined in the package and sub packages. Furthermore a reverse is performed in files placed in the directories corresponding to the package and sub packages and their sub directories. To apply the roundtrip at the project level update all the project and create classes not yet part of the model and defined in the referenced directories and their sub directories.
When you start the Java code roundtrip, it asks you for java catalog files, use cancel to finish to give the catalogs (may be immediately), then it perform the roundtrip and may be reverse depending on the case. The sources read by the Java code roundtrip are the ones having the extension specified in the generation settings. The tree formed by the sub-directories produce an equivalent tree of sub-packages, on whose the needed class view and deployment view are made to support the classes and artifacts. When a type is referenced but not defined in the reverse files, a class having the same name is defined under an additional package named unknown.
The reverse/roundtrip setting dialog of the modeler allows to specify through regular expression the files and / or directories whose must not be taken into account during a reverse and roundtrip, for instance to bypass test programs.
Obviously the Java code roundtrip tries to update existing classes and members, but sometimes it can't recognize and old member (mainly in case of renaming) deletes it and create a new one. Of course the Java code roundtrip tries to produce the definitions made in BOUML at the artifact / class / operation / relation / attribute levels. When it is possible it creates a relation rather than an attribute.
The Java code roundtrip works in four steps, during the first step all the project is upload, in the second step the elements to roundtrip are prepared, in the third step it scans all the files to establish the list of defined types, then the last step may roundtrip/reverse the files.
The trace window is used to indicate the steps, the updated classes and possible problems. The trace window is automatically opened by BOUML, it may also be manually opened through the Tools menu.
When the reverse is done the number of updated and created classes is written, then the useless elements are marked (all previous marks are removed) to allow you to know who they are, and the roundtrip ask for you to confirm if is delete these elements or not.
See also Java reverse and Java catalog.
Previous : Java reverse
Next : Java catalog