IBM Support

How to create binding classes under the "Template Instantiations" package

Question & Answer


Question

How do you create binding classes under the "Template Instantiations" package using the IBM Rational Modeling Extension for Microsoft.NET (RME.Net)?

Cause

Beginning in version 7.5.5, the preferred way of modeling generic instantiations is to create the binding classes under a package named "Template Instantiations". The C# to UML Transformation of RME .Net generates models according to this convention.

Answer

The RME.Net v7.5.5 release introduces changes to the way generic Instantiations are modeled. Models generated by the C# to UML transformation follow this new convention. From release 7.5.5 onwards, C# to UML transformation creates binding classes under a package named “Template Instantiations” in the target model. The UML to C# transformation will ignore the contents of this package during code generation.

Because of this change, if the C# to UML transformation is run with a model created by the C# to UML transformation from an earlier release of RME.Net as the target, the Fuse dialog will show changes related to binding classes, even if the source for the transformation has remained the same.

In RME .Net v7.5.4 and previous releases, a generic instantiation was modeled by creating a binding class in the same package as the generic class being modeled. The binding class had a template binding relationship with the generic class which was used to bind the formal template parameters with the actual parameters. The same was true for models created by the C# to UML transformation.

For example:

Consider a generic class com.ibm.AClass<T> in the model, AModel. Let the class ClassConsumer have an attribute called anAttribute of type AClass<int>. The model for this scenario would be:


As can be seen, anon_AClass is the binding class, created under com.ibm, and has a template binding relationship to com.ibm.AClass, binding the template parameter T to Integer.

Starting with the 7.5.5 release of RME. Net, the binding class (anon_AClass) willd, by default, be created in a package named “Template Instantiations” in the target model, while preserving its package hierarchy. Here is the new model for the same scenario:

With the new convention, anon_AClass has been created under a package called “Template Instantiations”, while preserving the namespace hierarchy for the generic class that it represents. i.e., anon_AClass has moved from com::ibm::anon_AClass to Template Instantiations::com::ibm::anon_AClass.

Users can still continue to model generic instantiations in the same way they did in v7.5.4 or earlier releases. But with the v7.5.5 release, the C#-to-UML transformation will create all binding classes under the “Template Instantiations” package. Users will see this difference in the Fuse dialog on their first reconcile of the model:



The following differences should be accepted in the Merge dialog:

1. Addition of "Template Instantiations" package.
2. Deletion of existing generic instantiation.

Users should adopt the new convention for modeling generic instantiations.

[{"Product":{"code":"SS5HXK","label":"Rational Modeling Extension for Microsoft .NET"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Modeling","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5.5","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
23 June 2018

UID

swg21415492