Adding methods to Java classes and interfaces in domain modeling class diagrams

You can use domain modeling class diagrams to add a method to a Java™ class or interface.

Before you begin

You must have a domain modeling class diagram with Java classes or interfaces open.

About this task

When you add methods to classes or interfaces, fully qualified names will be added for type proposals in packages if the Java Editor Code Assist's default Add import instead of qualified name preference option is cleared. Otherwise, import declarations will be added automatically. You can also use the action bar or the Methods tab in the Properties view to add methods to Java classes and interfaces.

Procedure

  1. In the diagram editor, right-click a Java class or interface; then click Add Java > Method.
  2. In the Create Java Method wizard, in the Name field, type a name for the new method.
  3. To make the method a constructor, select the Constructor check box.
  4. To throw exceptions, in the Throws field, enter an exception.
  5. Under Type and Dimensions, click a method return type and specify dimensions.
  6. Under Visibility, click a visibility style.
  7. Under Modifiers, click modifiers.
  8. Under Parameters, click Add; then in the Create Parameter window, type a name, select a parameter type, specify dimensions, and click OK.
  9. Click Finish.

Feedback