Preserving Javadoc information from previous releases of the product

To preserve the information between the Javadoc tags that were generated in previous releases of IBM® Rational® modeling products, run the Java-to-UML transformation once to migrate the Javadoc information into the documentation property of the corresponding element in the UML model.

About this task

In previous releases, Javadoc information for a Java code element was contained between the following tags:
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 */
Comments between these tags were protected when you ran the UML-to-Java transformation. These tags have been replaced with the following Javadoc tags:
/*
 * <!-- begin-UML-doc -->
 * <!-- end-UML-doc -->
 */
To preserve the information between the Javadoc tags that were generated in previous releases of the product, run the Java-to-UML transformation once to migrate the Javadoc information into the documentation property of the corresponding element in the UML model.
The next time that you run the UML-to-Java transformation, the following events occur:
  • For code elements that contain an @generated tag, the UML-Java transformation replaces the original Javadoc tags with the new Javadoc tags. The information between the tags is synchronized between the Java code and the UML model.
  • For code elements that do not contain an @generated tag, the updates to the documentation property in the model are not propagated to the Java code.
    Note: You can enable the synchronization of the Javadoc information and UML documentation property by adding an @generated tag to the appropriate Java code element, as in the following example:
    /**
     *<!-- begin-UML-doc -->
     *<!-- end-UML-doc -->
     *@generated
     */
Note: To generate the Javadoc tags that were generated in previous releases of the product, you can modify the code templates in the Java Development Toolkit. You might edit the code templates to maintain separate Javadoc information and UML model documentation. To edit the code templates, click Window > Preferences > Java > Code Style > Code Templates > Comments. For each item in the following list, click Edit and, in the Edit Template window, add the original Javadoc tags to the code comments:
  • Types
  • Fields
  • Constructors
  • Methods
  • Getters
  • Setters
In the Code Templates window, after you edit the code templates, click Apply > OK. The following code fragment shows an updated Types code template:
/**
 * @author $(user)
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
 * $(tags)
 */
For each code template that you edit, the next time that you run the UML-to-Java transformation, it generates both types of Javadoc tags, as in the following example:
/**
* <!-- begin-UML-doc -->
* Comments between these tags are synchronized between the UML model and generated Java code.
* <!-- end-UML-doc -->
* <!-- begin-user-doc -->
* Comments between these tags appear only in the code.
* <!-- end-user-doc -->
* @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */

Feedback