Lesson 4: Create and refine a class-to-interface mapping declaration
This lesson shows you how to create a class-to-interface mapping declaration in the mapping model. This mapping declaration contains mapping rules that create an interface whose name is derived from the name of the class in the source model, and that copy only the public methods of the class in the source model.
About this task
To create a class-to-interface mapping declaration in the mapping model:
Procedure
Add input and output objects to the class-to-interface mapping declaration
About this task
After you create the class-to-interface mapping declaration, you specify a UML class as the input object, and a UML interface as the output object.
To add an input object and an output object to the class-to-interface mapping declaration:
Procedure
- Click the Add an input object icon, which is the leftmost icon on the toolbar of the map that you are editing.
- In the Add Input window, in the Element pane, expand uml, click Class, and click OK.
- Click the Add an output object icon, which is the second icon from the left on the toolbar of the map that you are editing.
- In the Add Output window, in the Element pane, expand uml, click Interface, and click OK.
- Click .
Results
Define mapping rules between the attributes of input and output objects
About this task
After you add an input and output object to the class-to-interface mapping declaration, you can define the mapping rules between the attributes of the input and output objects.
For this lesson, you create a custom mapping rule that creates an interface called IClassName. You also create a submap mapping rule that invokes the operation-to-operation submap that you create in Lesson 3: Create and refine a class-to-class mapping declaration, and add an input filter to the submap mapping rule to specify that only public operations are transformed into the target interface.
To define the mapping rules between the attributes of the input and output objects: