Specifying exceptions in UML operations

To represent Java™ exceptions in a UML model, you can specify UML classes in the RaisedException property of a UML operation. When you run the UML-to-Java transformation, the transformation creates a Java method that corresponds to the UML operation. The method signature contains a throws statement that contains the class or classes that you specify in the RaisedException property.

You must be in the Modeling perspective and you must have a UML model open. The UML model must contain a class that contains an operation. A UML class that represents the appropriate exception object must exist in the current workspace.

To specify Java exceptions in a UML operation:
  1. In the Project Explorer view, right-click a UML operation; then click UML Properties.
  2. In the Properties dialog box, in the left pane, click RaisedException.
  3. To add an exception, complete the following steps:
    1. In the right pane, click the ellipsis button (...).
    2. In the Select Element dialog box, select the UML class that represents the appropriate exception object and click OK.
    3. Repeat steps a and b to specify additional exception objects.
  4. Optional: To delete an exception object from an operation, in the Properties dialog box, in the right pane, click the row that contains the exception that you want to delete; then click the delete button.
  5. Click Close.
Related concepts
UML-to-Java transformations
Related reference
Interpretation of UML elements by UML-to-Java transformations

Feedback