argouml-tigris-org.github.io

Web pages for the ArgoUML project.

From the ArgoUML wiki at argouml.tigris.org.
Wiki: <<Subsystem>> Java - Code Generation and Reverse Engineering

Purposes
to allow the model to be converted into java code and updated either in java or in the model; to allow some java code to be converted into a model.
Located

org.argouml.language.java in the argouml-java project.

Layer

<<Layer>> Loadable subsystems

Design of the subsystem

Which sources are involved?

The package org.argouml.uml.reveng is supposed to hold those classes that are common to all reverse engineering (RE) packages. At the moment this is the Import class which is mainly responsible to recognize directories, get their content and parse every known source file in them. These are only Java files at the moment, but there might be other languages like C++ in the future. With this concept you could mix several languages within a project.

The package org.argouml.uml.reveng.java holds the Java specific parts of the current RE code. C++ RE might go to org.argouml.uml.reveng.cc, or so...

How is the grammar of the target language implemented?

It is an Antlr ( http://www.antlr.org) grammar, based on the Antlr Java parser example. The main difference is that the AST (Abstract Syntax Tree) generation and tree-parser have been removed. The ArgoUML code parses the source file and generates Model subsystem objects directly from the sources. This was done to avoid the memory usage of an AST and the frequent GC while parsing many source files. The disadvantage of this approach is that it requires multiple parser passes rather than being able to work from the pre-parsed AST.

Which model/diagram elements are generated?

The *context classes hold the current context for a package, class etc. When the required information for an object is available, the corresponding Model subsystem object is created. The collection of newly created model elements is returned to the common Import code where it can be used to add the elements to a diagram or diagrams if the user has so requested.


CategoryFromCookbook

<<Subsystem>> Java - Code Generation and Reverse Engineering (last edited 2009-03-06 15:08:31 -0700 by linus)