Specifying arguments for pattern instances

You add argument values to a pattern instance in the Project Explorer view or in the diagram editor by using the Pattern Parameters page of the Apply Pattern wizard. In the diagram editor, you can also use drag and drop gestures to specify values.

Before you begin

Before you can specify arguments for a pattern's parameter, you need to add a pattern instance to a UML model in the Project Explorer view or to its freeform or class diagram editor.

About this task

You can specify arguments for multiple concurrent instances of the same pattern. An argument value can participate in more than one instance. Specifying values is a dynamic process: each argument is immediately bound to the parameter and the pattern's expansion instructions are invoked to perform the intended modifications to your model. There is no parameter sequence to follow however, the pattern design may require that certain argument values be supplied before complete expansion can occur. Consult the pattern documentation if you have any questions.

Some options to create the pattern instance also specify an argument at the same time.

The following list represents the ways you can specify arguments:

  • To create a new element with a default name that is added to the model, hover the cursor over the template parameter and click an element icon in the action bar. Class type pattern instance with action bar showing.
  • To specify an existing element as an argument by dragging it, drag a model element from the Project Explorer view or in the diagram editor (the element becomes translucent so you can see the instance) over the template parameter and drop it.
    Drop element on a template parameter in a pattern instance
  • To specify an existing element in the model by supplying its name: Hover the cursor over the template parameter, click the text or value box icon Text icon selected in pattern instance in the action bar and type the name of an element.
    Pattern instance with argument specified by an existing element.
  • To create and name a new element that is added to the model, hover the cursor over the template parameter, click the text or value box icon New element name typed into template parameter in pattern instance in the action bar, and type a unique name next to the parameter to add the new element.
    Pattern instance with one argument.
  • To select a value for a template parameter from a set of values, hover the cursor over the template parameter, click the element icon in the action bar and double-click one of the values.
    Select a value from a set in the template parameter on the pattern instance

To specify argument values for a pattern instance, do one of the following steps:

Procedure


Feedback