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:
- In the Pattern Authoring view, right-click
the pattern and click Add Parameter. The New
Pattern Parameter wizard opens.
- Type a name for the parameter in the Name field. The Class Name is automatically derived
from the parameter name.
- Accept the class name as generated from the parameter name, or
modify it in the Class Name field.
- 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.
- 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.
- To add a parameter dependency, do the following steps:
- Click the Parameter Dependency tab to open
the Parameter Dependency page.
- In the Existing Parameters field, click
one or more parameter names.
- Click a right-arrow button to move the parameter name into the Client
Parameter or the Supplier Parameter field.
- 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.