# Java reverse

The Java code reverse is a plug-out directly written in C++.

Note that the Java code reverse cannot be used to update already defined classes, the reverse creates the reversed classes into the model without considering already existing classes. To update existing classes from source use the Java code roundtrip.

The Java code reverse plug-out may be applied only on a package.

When you start the Java code reverse, it asks you for java catalog files, use cancel to finish to give the catalogs (may be immediately), then it ask for a directory, then it reads all the sources placed under the selected directory and sub-directories. The sources read by the Java code reverse 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 reverse 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 reverse works in two steps, during the first step it scans all the files to establish the list of defined types, then the second step may reverse the files.

When the Java code reverse has a problem, for instance on a syntax error, it produces a warning in the trace window. 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 reversed classes, operations, attributes and relations is written, for instance in case I reverse a full JDK Java distribution :

See also Java roundtrip and Java catalog.

Previous : Java generator

Next : Java roundtrip