When refactoring code, it is often the case that class names are changed or updated in the code. If it detects that new types have been added or renamed during reverse engineering, UModel (version 2009 or later) displays a dialog box. The new types are listed in the "Name in code" column while the assumed original type name is listed in the "Name in model" column. UModel attempts to determine the original name by relying on namespace, class content, base classes and other data.
If a class was renamed, select the previous class name using the combo box in the "Name in model" column, e.g. C1. This ensures that all related data are retained and the code engineering process remains accurate.
Changing class names in the model and regenerating code
Having created a model and generated code from it, it is possible that you might want to make changes to the model again before going through the synchronization process.
E.g. You decide that you want to change the class names before generating code the second time round. As you previously assigned a file name to each class, in the "code file name" field of the Properties window, the new class and file name would now be out of sync.
UModel prompts if you want the code file name to agree with the new class name, when you start the synchronization process. Note that you also have the option to change the class constructors as well.
Round-trip engineering and relationships between modeling elements
When updating model from code, associations between modeling elements are automatically displayed, if the option Diagram Editing | Automatically create Associations has been activated in the Tools | Options dialog box. Associations are displayed for those elements where the attributes type is set, and the referenced "type" modeling element is in the same diagram.
InterfaceRealizations as well as Generalizations are all automatically shown in the diagram when updating model from code.
© 2019 Altova GmbH