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) > Attribute mapping for Java (Java code)
  
Attribute mapping for Java (Java code)
For each Class, Data Type and Interface scoped Attribute, ACS generates an attribute in the code. Model and Package scoped Attributes are ignored.
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.
The generation of an Attribute is derived from its properties and the tagged values set for Tag Definitions applied by the «Java Attribute» stereotype:
Properties:
The Behavior property is used with the Port property - for more information, see the Port property entry.
The Composite property is used only in the generation of Ports. For more information, see the Port property that follows.
If the Data Type property is set, ACS generates the value as the attribute's data type.
If no data type is specified, ACS generates int by default. If you want ACS to generate a different default in the absence of a data type for an Attribute or Parameter, change the default value that is specified in the JavaGen.ini file. Tell me more...
Reverser Notes: When reverse engineering a attribute's data type:
If the data type is modeled in the Model or is going to be reverse engineered to the Model, the Attribute's Data Type references the appropriate item.
If the data type is not modeled in the Model and is not going to be reverse engineered to the Model, the Attribute's Data Type is set to the name of the data type (as text).
If the Default property is set, ACS generates the Attribute with an initial value.
Example code:
public class foo
{
// Attributes
private int Attribute3 = 25;
private static float Attribute2 = 3.14;
private static string Attribute1 = "foo";
}
If the tagged value of the Java Array Spec tag definition has been set, the Multiplicity property is ignored. If the tagged value of the Java Array Spec tag definition has not been set, the Multiplicity property is generated as follows:
For 'only one', ACS generates the attribute as having a single value.
Example code:
public class foo
{
// Attributes
private int myInt;
}
For any other value, ACS generates an array.
Example code:
public class foo
{
// Attributes
private int[] myInt;
}
The Name property is generated as the name of the attribute in the code.
* 
ACS may modify the attribute name that is added to the code to make it valid for Java. You can specify the exact attribute name to add to the code through the CODE_GENERATION_NAME property of an Attribute. Tell me more...
If the Port property is set to true (Port check box selected on Property Pages) and the Behavior property is set to true (Behavior check box selected on Property Pages) the attribute is initialized to the 'this' reference as long as the following properties apply:
Example code:
For the following example:
public class Class1
implements Interface1
{
// Roles
// following class generated to delegate messages sent to rPort1
class _RtS_rPort1_Interface1 implements Interface1
{
}
_RtS_rPort1_Interface1 rPort1;
}
Composite property is set to false.
Storage property is set to On Instance.
Multiplicity property is set to 'zero or one' or 'only one'.
The Port has no navigable associations to any Class, Part or Port.
The data type is an Interface that is implemented by the Class.
If the Port property is set to true (Port check box selected on Property Pages) and the Behavior property is set to false (Behavior check box cleared on Property Pages), ACS generates a local class to implement the interface data type as long as the following properties apply:
Example code:
For the following example:
public class Class1
{
// Roles

// following class generated to delegate messages sent to rPort1
class _RtS_rPort1_Interface1 implements Interface1
{
// Operations

public void Operation1()
{

rXYZ.Operation1();

}

private Class3 rXYZ;

}

_RtS_rPort1_Interface1 rPort1;

}
Composite property is set to true.
The Data Type is an Interface.
The generated class derives from the data type and implements each function by delegation to all navigable Roles that support the Operation.
If the Storage property is set to On Class, the attribute is marked as static.
Example code:
public class foo
{
// Attributes
protected static int myInt;
}
If the Read Only property is set to TRUE (Read Only check box selected on Property Pages), the attribute is generated as final.
Example code:
public class foo
{
// Attributes
private final int bar = 10; // Read Only = true
private char leaveMeAlone; // Read Only = false
}
The Unique property is ignored.
If the Visibility property is set to Public, Protected or Private, ACS generates the attribute with Public, Protected or Private access, unless the Java Default Access tag definition is set to TRUE.
Example code:
public class foo
{
// Attributes
public int myInt;
protected String name;
}
If Visibility property is set to Package or the Java Default Access tag definition is set to TRUE, the Access property is ignored and ACS generates the attribute with no access specifier.
Tag Definitions:
The following Tag Definitions are applied to an Attribute by the «Java Attribute» stereotype:
If the tagged value of the Java Actual Arguments tag definition has been set and the Attribute is using a Java Generic as its data type, ACS generates the value as the arguments that are passed to the generic type.
If the tagged value of the Java Array Spec tag definition has been set, ACS generates the value after the attribute's data type. Note that the tagged value should be one or more pairs of empty brackets.
Example code:
class foo
{
// Attributes
private int[] someNumbers;
private int[][] twoDArray;
}
If the tagged value of the Java Default Access tag definition is set to TRUE, ACS generates the attribute with no access specifier, irrespective of how the Visibility property is set.
Example code:
public class foo
{
// Attributes
int myInt;
String name;
}
If the tagged value of the Java Field Modifier tag definition is set to volatile, transient or volatile transient, ACS generates the selected keyword in front of the attribute's data type.
Example code:
public class foo
{
// Attributes
int myInt;
String name;
}
If the tagged value of the Java Needs Qualified Type tag definition is set to TRUE, ACS generates the attribute's data type with a qualified name.