Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > Java code > Reverse engineering legacy Java code > Mapping information > Mapping information (excluding state diagrams) > Class mapping for Java (Java code)
  
Class mapping for Java (Java code)
For each Class, ACS generates a class in a file of the same name.
Example code:
package name.of.scoping.package;
public class foo
{
}
The generation of a Class is derived from the items it owns, properties of the Class, and the tagged values set for Tag Definitions applied by the «Java Class» stereotype.
Child items:
If the Class owns Attributes, ACS generates attributes within the class code. For Attribute mapping information, see Attribute mapping for Java (Java code).
Example code:
public class foo
{
// Attributes
private int anAttribute;
}
Reverser Notes: When reverse engineering a class' attributes, the Reverser will reverse engineer the attribute as a Role if all of the following statements are true:
The Java attribute's data type can be identified as a class in the code being reverse engineered.
The Java class that is used as a data type is being reverse engineered.
The Reverser cannot match the Java attribute to an Attribute in the Model.
If the Class owns Classes, ACS typically generates the nested Classes as inner classes.
Example code:
public class foo
{
public static class bar
{
// ...
}
}
* 
If for a nested Class the tagged value of the Java Non Member tag definition is set for TRUE, ACS generates the class construct outside of the class construct created for the parent Class.
Example code:
// File : C:/Code/Class1.java
public class Class1
{
}
class Class2 // Class2 is nested in Class1
{
}
If the Class owns Data Types, ACS typically generates the nested Data Types as inner classes.
* 
If for a nested Data Type the tagged value of the Java Non Member tag definition is set for TRUE, ACS generates the class construct outside of the class construct created for the parent Class.
If the Class owns Dependencies, ACS generates import or implements statements in the code. For Dependency mapping information, see Dependency mapping for Java (Java code).
Example code:
import java.lang.*;
If the Class owns Generalizations that define inheritance, ACS generates the Generalizations as extends or implements statements. For Generalization mapping information, see Generalization mapping for Java (Java code).
Example code:
public class foo extends bar implements iface1
{
}
If the Class owns Interfaces, ACS typically generates the nested Interfaces as inner interfaces.
* 
If for a nested Interface the tagged value of the Java Non Member tag definition is set for TRUE, ACS generates the interface construct outside of the class construct created for the parent Class.
If the Class owns Operations, ACS generates the Operations as methods in the code. For Operation mapping information, see Operation mapping for Java (Java code).
Example code:
public classfoo
{
// Operations
public int anOperation()
{
// Whatever
}
}
If the Class owns Roles, ACS generates the Roles as attributes within the code. For Role mapping information, see Association and role mapping for Java (Java code).
Example code:
public class foo
{
AnotherClass rAnotherClass;
}
Other child items are ignored.
Properties:
If the Abstract property is set to true (Abstract check box selected on Property Pages), ACS generates the class as abstract.
Example code:
public abstract class foo
{
}
If the Description property has a value, ACS generates the Description as a comment on the line before the class declaration.
Example code:
// Description of class foo
public class foo
{
}
The Description property is also generated as a file comment if the «Java Class» stereotype is not applied to the Class.
The Formal Template Parameters are generated as the parameters of a Class set up as a Java Generic through its Template property.
The Name property is generated as the name of the Java file and as the name of the Java class in that file.
Example code:
// File : C:/Code/Class1.java
public class Class1
{
}
* 
ACS may modify the class name that is added to the code to make it valid for Java. You can specify the exact class name to add to the code through the CODE_GENERATION_NAME property of a Class. Tell me more...
The Persistent property is ignored.
The Structure property is ignored.
If the Template property is set
If the Template property is set to TRUE (Template check box selected on Property Pages), the Class is generated as a Java generic.
The Template Specialization property (and any Template Specialization Parameters) is ignored.
The Union property is ignored.
The Visibility property is generated as follows:
For non-nested Classes, ACS ignores the Visibility. Non-nested Classes are generated as Public, unless the tagged value of the Java Default Access tag definition is set to TRUE.
For nested Classes, the Class is generated as either Public, Private or Protected, unless the tagged value of the Java Default Access tag definition is set to TRUE. If the tagged value of the Java Default Access tag definition is set to TRUE, the Visibility property is ignored.
Tag Definitions:
If the «Java Module» stereotype is applied to the Class, ACS generates a Java file for the Class, but the Class is not defined as a Java class in that file.
The following Tag Definitions are applied to a Class by the «Java Class»stereotype:
If the tagged value of the Java Default Access tag definition is set to TRUE, ACS generates the Java class with no access specifier.
Example code:
class foo
{
}
If the tagged value of the Java Extends Text tag definition has been set, the value is generated as the extends statements for the Java class.
Example code:
public interface Class1
extends ClassNotInModel
{

}
Reverser Notes: When reverse engineering extends statements, the Reverser attempts to model the extends statements as Generalizations in the Model. If the Reverser cannot model the extends statements through Generalizations, the extends statements are recorded through the Java Extends Text tag definition.
The tagged value of the read-only Java File tag definition is used for opening generated code files from Modeler. This value is set by ACS.
If the tagged value of the Java File Comment tag definition has been set, ACS generates the value at the top of the Java file.
Example code:
// This is the java file comment
// For file foo.java
public class foo
{
}
If the tagged value of the Java Final tag definition is set to TRUE, ACS generates the Java class as final.
Example code:
// Class foo
public final class foo
{
}
If the tagged value of the Java Is Static tag definition is set to TRUE, ACS generates a nested class as static.
Example code:
public class foo
{
static private class bar
{
// ...
}
}
If for a nested Class the tagged value of the Java Non Member tag definition is set to TRUE, ACS generates the class construct outside of the class or interface construct created for the parent item (class constructs for nested Classes are generated in the Java file created for the parent item).
Example code:
// File : C:/Code/Class1.java
public class Class1
{
}
class Class2 // Class2 is nested in Class1
{
}
If the tagged value of the Java Implements Text tag definition has been set, the value is generated as the implements statement for the Java class.
Example code:
public class Class4
implements ClassNotInModel
{
}
Reverser Notes: When reverse engineering implements statements, the Reverser attempts to model the implements statements as Dependencies (of type Interface Realization) in the Model. If the Reverser cannot model the implements statements through Dependencies, the implements statements are recorded through the Java Implements Text tag definition.
If the tagged value of the Java Import Text tag definition has been set, the value is generated as import statements for the Java class.
Reverser Notes: When reverse engineering import statements, the Reverser attempts to model the import statements as Dependencies in the Model. If the Reverser cannot model the import statements through Dependencies, the import statements are recorded through the Java Import Text tag definition.