| Mapping declaration | Input and output object type | Mapped attributes | Mapping rule type | Mapping rule description |
|---|---|---|---|---|
| Primitive2Primitive | UML primitive type | name | move | Creates a primitive type in the element whose submap invokes the Primitive2Primitive mapping declaration |
| Parameter2Parameter | UML parameter | name, visibility | move | Creates a parameter in the element whose submap invokes the Parameter2Parameter mapping declaration; the generated parameter has the same name and visibility as the parameter in the source input element |
| type | submap | For each type in the element whose submap invokes this
mapping declaration, these are results:
|
||
| Operation2Operation | UML operation | name, visibility | move | Creates an operation in the element whose submap invokes the Operation2Operation mapping declaration; the generated operation has the same name and visibility as the operation in the source input element |
| ownedParameter | submap | For each parameter in the operation, this submap invokes the Parameter2Parameter mapping declaration |
In this tutorial, the Paramater2Parameter mapping declaration invokes the Primitive2Primitive mapping declaration to create parameters of type primitive.
To create the primitive-type-to-primitive-type mapping declaration in the mapping model:
After you create the Primitive2Primitive mapping declaration, you must add an input object and an output object to it. In this lesson, you specify a UML primitive type as the input and output object.
To add an input object and an output object to the Primitive2Primitive mapping declaration:
For this lesson, create a move mapping rule that creates a primitive type in the target model. The generated primitive type has the same name as the primitive type in the input model; you could also think of this as creating a copy of the primitive type.
To define a move mapping rule that defines a relationship between the name attribute of the PrimitiveType input and output objects:
This section shows you how to create a mapping declaration that specifies a UML parameter as both the input and output object. This parameter-to-parameter mapping declaration contains mapping rules that, when you run the generated transformation, create a parameter in the target model whose name, visibility, and type are the same as the parameter in the element whose submap invoked this mapping declaration. In this tutorial, the Operation2Operation mapping declaration contains a submap mapping rule that invokes this mapping declaration.
To create a parameter-to-parameter mapping declaration:
After you create the mapping declaration, you must add an input object and an output object to it. In this lesson, you specify a UML parameter as the input and output object.
To add an input object and an output object to the Parameter2Parameter mapping declaration:
After you add the input and output objects to the mapping declaration, you can define the mapping rules between the attributes.
In this section, you create submap rules and a move mapping rule that, when you run the generated transformation, create a parameter in the target model whose name, visibility, and type are the same as the parameter in an element of the source model. In this tutorial, the Operation2Operation mapping declaration invokes this mapping declaration.
To define the mapping rules in the Parameter2Parameter mapping declaration:
Lesson 3: Create and refine a class-to-class mapping declaration showed you how to create an operation-to-operation mapping declaration. In this section, you are now ready to create mapping rules in this mapping declaration. When you run the generated transformation, these mapping rules create an operation in the target model whose name, visibility, and parameters are the same as the operation in the source model. In this tutorial, the Class2Class and Class2Interface mapping declarations invoke this mapping declaration.
To define the mapping rules in the Operation2Operation mapping declaration: