Chapter 4 Reverse Engineering

Reverse engineering Java

You can reverse engineer files that contain Java classes into an OOM. For each existing class in a Java file, a corresponding class is created in the model, with the same name and containing the same information. When you reverse engineer a Java class that already exists in a model, you can choose in the Merge Model window either to replace the existing class, or to keep the existing class definition in the model.

Reverse engineered Java classes always keep their original names.

When you reverse engineer classes from Java files to a diagram, you can choose from one of the following four sources:

Source

Java .java files

Java .class files

Directory

Archived Java files

Description

Each file contains one or several class definitions

Files that contain one class definition that has the same name as the file

Folder from which you can reverse all the Java files, including all those contained in it’s sub-directories

Compressed .jar or .zip files. Only the Java classes contained in these files are imported into your model. All other information is discarded

Extension

.java

.class

.zip and .jar

Inner Classes

An inner class is a class definition that is defined within another (outer) class

 

definition. Inner classes are commonly used in Java. They help you to

 

improve the overall visibility of your model by allowing you to group

 

together classes that logically belong together.

 

When you reverse a Java class that contains one or more inner classes, one

 

class is created for the outer class, and one class is created for each of the

 

inner classes.

 

A dependency link is created between each inner class and the outer class to

 

which it belongs. The name of each inner class is prefixed by the name of the

 

outer class.

151

Page 161
Image 161
Sybase 7.5 Reverse engineering Java, Together classes that logically belong together, Inner classes, Outer class, 151