Reverse engineering code comments (Java code)
Typically, the Reverser reverse engineers comments that precede and are on the same line as code elements. All comments are reverse engineered to the Description property of the item created for the associated code element. When reverse engineering a Java document comment, the first character of the item's Description in the model is set to an asterisk.
Reverse engineering single line comments
In this example, the code element for Class1 is prefixed by two single comment lines. The two comment lines are reverse engineered to the Description property of the Class that is created in the Model.
Reverse engineered code
Modeler
//Description of Class1 line1
//Description of Class1 line2
public class Class1
{
}
* 
Note that the Reverser uses white space to delimit preceding comments. For example, if in the preceding example there was white space between the two comment lines, only the second comment would be reverse engineered.
Reverse engineered code
Modeler
//Description of Class1 line1
//Description of Class1 line2
public class Class1
{
}
Reverse engineering multi-line comments
The Reverser can reverse engineer multi-line comments, but those comments are then generated as single line comments.
In this example, the multi-line comment is reverse engineered as two lines in the Class1 Description.
Reverse engineered code
Modeler
/*Description of Class1 line1
Description of Class1 line2*/
public class Class1
{
}
When Class1 is generated, the two lines of the Description are generated as two single line comments.
Modeler
Generated code
//Description of Class1 line1
//Description of Class1 line2
public class Class1
{
}
Reverse engineering Java document comments
When the Reverser reverse engineers Java document comments, the first character of the Description is set as an asterisk. When generating a Description, if the first character of a Description is an asterisk, ACS generates the Description as a Java document comment.
In this example, the Java documentation comment is reverse engineered as two lines in the Class1 Description. The first character of the Description is an asterisk.
Reverse engineered code
Modeler
/**Description of Class1 line1
Description of Class1 line2*/
public class Class1
{
}
When the Class is generated, ACS generates the description as a Java document comment.
Modeler
Generated code
/**Description of Class1 line1
Description of Class1 line2*/
public class Class1
{
}
Reverse engineering preceding and inline comments
In the following example, a Java comment precedes the code element and a Java comment follows the code element for Class1. Both comments are reverse engineered to the Description property of the Class that is created in the Model.
Reverse engineered code
Modeler
// Preceding comment
public class Class1
// Inline comment
{
}
When the Class is generated, what was previously an inline comment is generated as a preceding comment.
Modeler
Generated code
// Preceding comment
// Inline comment
public class Class1
{
}
Was this helpful?