Adding parameters to patterns

A pattern usually has at least one parameter although this is not a requirement. Parameters define the targeted argument's UML 2.0 type and the acceptable multiplicity values. Each parameter is represented by a Java™ class and contains the code instructions to perform the work accomplished by pattern expansion.

You can specify dependencies between parameters. When you assign another parameter as a client or supplier parameter, it dynamically adds the reciprocal assignment to the parameter you are adding. Thus, moving an existing parameter into the Supplier field assigns the role of client to the parameter you are adding.

To add a parameter to a pattern:

  1. In the Pattern Authoring view, right-click the pattern and click Add Parameter. The New Pattern Parameter wizard opens.
  2. Type a name for the parameter in the Name field. The Class Name is automatically derived from the parameter name.
  3. Accept the class name as generated from the parameter name, or modify it in the Class Name field.
  4. Type a short description of the parameter that can assist the pattern applier to specify arguments for the pattern. The short description appears on the Short Description page of the Pattern Explorer view and as a tooltip when the pattern applier hovers over the template parameter on the diagram view.
  5. In the Type field, accept the UML 2.0 type of Class for the parameter's type or click Browse and select another UML 2.0 type.
  6. To add a parameter dependency, do the following steps:
    1. Click the Parameter Dependency tab to open the Parameter Dependency page.
    2. In the Existing Parameters field, click one or more parameter names.
    3. Click a right-arrow button to move the parameter name into the Client Parameter or the Supplier Parameter field.
  7. Click the General tab to return to the parameter definition or OK to close the wizard.
The parameter is added to the pattern. As you develop the pattern, you can modify the parameter properties by using the Properties view.

Parent topic: Modifying patterns during design

Related concepts
IBM Rational design patterns
Pattern code and support files

Related tasks
Creating pattern projects and libraries
Assigning patterns to groups
Adding dependencies to parameters
Setting pattern property values

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.