IBM Support

How to use the bind stereotype to instantiate a Template class in Rational Rhapsody

Question & Answer


Question

How do you use the bind stereotype to instantiate a Template class in IBM Rational Rhapsody?

Cause

You would like to instantiate a Template class using a Regular class.

Answer

Although Rational Rhapsody does not provide the <<bind>> stereotype as a predefined type, its functionality is predefined; hence, it is mandatory to manually create the <<bind>> Stereotype in the model.

You can then use the bind stereotype to instantiate a template class from a regular class in Rational Rhapsody in the following manner:

  1. Add a Profile to the existing project in Rational Rhapsody

    Right click on Project > Add New > Profile

  2. Add a Stereotype to the newly created Profile

    Right click on Profile > Add New > Stereotype

  3. Rename the Stereotype to bind

  4. Set the Stereotype applicable to the Dependency metaclass
    1. Right click on Stereotype > Features
    2. Navigate to the General tab and set value of property Applicable to as Dependency
    3. Click OK

      Note: You should already have a Template class and Regular class created in the model before applying Step 5

  5. Create a dependency relation from the Regular class to the Template class using the Drawing toolbar

  6. Apply the <<bind>> Stereotype to the dependency relation between the Regular class and Template class
    1. Right click on Dependency relation > Features
    2. Navigate to General tab and value of set value of Stereotype as bind
    3. Click OK

      Once after completion of Step 6 the Regular class is converted into a Template Instantiation class and can be verified via its Template Instantiation tab in the Features Dialog

  7. Instantiate the Template class by providing values to the Template class parameters in the Template Instantiation tab
    1. Right-click on Template Instantiation class > Features
    2. Navigate to Template Instantiation tab & provide values in the Value filed for the template parameters
    3. Click OK

On generating code for the model , you will observe the Regular class has converted into a template instantiation for the Template class

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"7.6.1.1;7.6.1;7.6.0.1;7.6;7.5.3.2;7.5.3.1;7.5.3;7.5.2.1;7.5.2","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21591512