Step 4: Extending the Model by Reverse-Engineering an Existing Class

Previous topic
Previous
Next topic
Next

This final task shows you how to extend the model by adding an existing class to the project and adding it to the diagram.

To extend the class model:

  1. Right-click the project node in the Navigator pane and choose New Java Class.
    OR
    Click the project node in the Navigator pane, choose New, then choose Java Class from the General category of the New Gallery.
  2. Enter the name of the class as OrderItem.
  3. Enter the package name as orderEntry.
  4. Deselect the Generate default constructor checkbox.
  5. Click OK.
    The new OrderItem class is opened in the Code Editor.
  6. Click the Save icon on the toolbar, or choose File | Save to save these changes to OrderItem.java.
  7. Click the diagram name in the Document Bar to display the diagram again.
  8. Drag the OrderItem class from the from the Navigator pane, and drop on the diagram.
  9. Model a strongly aggregated association between Order and OrderItem then examine the changes that appear in the Java source code of OrderItem.java and Order.java.

Finish the tutorial be reviewing the Modeling Java Classes Tutorial Summary.


Related Topics:

Class Diagram Notation