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:
- In the Project Explorer view, right-click
a UML operation; then click UML Properties.
- In the Properties dialog box, in the left pane, click RaisedException.
- To add an exception, complete the following steps:
- In the right pane, click the ellipsis
button (...).
- In the Select Element dialog
box, select the UML class that represents the appropriate exception object
and click OK.
- Repeat steps a and b to specify additional exception
objects.
- 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.
- Click Close.