Adding parameters to operations

In UML diagrams, you can add parameters to pass information into and out of operations.

Before you begin

You must have a diagram open in the diagram editor, and the operations list compartment must be visible. Ensure that you have not set preferences to filter or hide operations. To see the parameters that you add to an operation in a classifier, you must modify the classifier's properties to show operation signatures.

About this task

To add a parameter to an operation:

Procedure

  1. In the diagram editor, click an operation to select it and click the selection to edit it.
  2. In the parentheses, type the parameter's direction kind (if applicable), name, type expression, and default value in the following syntax:
    operation ([direction] name : type-expression = default-value)
    For example: getBalance([in] day : Date = 01/01/2005)
  3. Optional: To add a return type, type the information after the parentheses. For example: getBalance(day : Date = 01/01/2005) : MoneyType

Results

Tip: You can also add parameters to operations in the Project Explorer view.

Feedback