Impact of code changes on UML-to-Java transformation output

If you rerun the UML-to-Java transformation or the UML-to-EJB transformation, the transformation processes the changes that you make to any previously generated code, depending on both the type of code element and the type of change.

The transformation does not update or refactor code beyond the scope of the source or target that you specify in the transformation configuration. If code that is beyond the transformation scope contains references to changed model elements, you must update the code manually.

The following table lists how the transformation handles changes to previously generated code when you rerun a transformation, assuming that you do not remove the @generated tag.

Note: Unless otherwise stated, the transformation adds a warning problem marker to the @generated tag of the code element that you change. The warning marker indicates that the transformation will overwrite the element. The warning message text suggests that you remove the @generated tag to retain your changes.
Code element Change Impact on previously generated code when you rerun the transformation
Note: Unless indicated otherwise, it is assumed that you have configured the transformation to create trace relationships between source and target elements.
Non-nested class or interface (includes top-level classes and interfaces) Add implementation or extension The added implementation or extension is removed.
Move If you move the Java™ file to a project outside of the scope of the transformation, the transformation creates a Java file in the location defined in the source model.

If you move the Java class or interface to a different package in the project, the transformation moves the Java file back to the original location.

The file overwrite option that you specify in the transformation configuration determines whether the previously generated Java file is deleted.

If the transformation is not configured to create trace relationships:
  • If you move the Java file to a project outside of the scope of the transformation, the transformation creates a Java file in the location defined in the source model.
  • If you move the Java class or interface to a different package in the project, the transformation generates a Java file in the location defined in the source model.
  • The file overwrite option that you specify in the transformation configuration determines whether the previously generated Java file is deleted.
Remove implementation or extension The previously generated implementation or extension is restored.
Rename The class is refactored to reflect the class name in the UML model
Field Move within the same Java file The field and its getters and setter methods, if generated, are restored to the original location that the model defines.

Changes to generated getter and setter method bodies are preserved.

Move to a different Java file The field and its getter and setter methods, if generated, are deleted from the new location if the new location is a generated Java file, and regenerated in the original location that the model defines.

Changes to generated getter and setter method bodies are not preserved.

If the transformation is not configured to create trace relationships:
  • The field is deleted from the new location, and regenerated in the original location that the model defines.
  • Getter and setter methods, if moved, are not preserved in the new location, and are regenerated in the original location that the model defines.
Rename The field and associated getter and setter methods are restored to the original name that the model defines.
Import statement Add The import statement is retained.
Method Modify return type The previously generated return type is restored.
Modify signature The previously generated method and signature are restored.

The method with the new signature is removed.

Changes to the method body are preserved.

Move within the same Java file The method is restored to the original location that the model defines.

Changes to the method body are preserved.

The method in the new location is removed.

Move to a different Java file If the new location is a generated Java file, the method is deleted from the new location, and created in the original location. If the new location is a non-generated Java file, the method is not deleted from the new location, and the method is regenerated in the original location that the model defines.

Changes to the method body are not preserved.

Rename The previously generated method is restored.

The renamed method is removed.

Nested class or interface Move within the same Java file If the new location is a generated Java file, the nested element is restored to the original location that the model defines.

All elements are regenerated in the original location that the model defines.

Changes to the nested elements are preserved.

Move to a different Java file If the new location is a generated Java file, nested elements and all child elements are deleted from the new location.

All elements are regenerated in the original location that the model defines.

Changes to the nested elements are not preserved.

Nested class or interface Rename The previously generated class or interface is restored to the original name that the model defines.

Changes to the nested elements are preserved.

If the transformation is not configured to create trace relationships:
  • The previously generated class or interface is restored to the original name that the model defines.
  • Changes to the nested elements are not preserved.
Qualifier Modified The previously generated qualifier is restored using the values in the Keywords property of the UML element.

Feedback