Using the Stub Implementation Pattern

From RAD Studio
Jump to: navigation, search

Go Up to Applying Pattern Procedures

This topic explains how to use the stub implementation pattern. See the Stub implementation patterns section in Patterns.

To create an inheritance link using the Link by Pattern command

  1. Open a class diagram in the Diagram View.
  2. On the Tool Palette, click Link by Pattern.
  3. In the class diagram, click the source class and drag-and-drop the link to the destination class or interface. The Pattern Wizard opens.
  4. In the Pattern Wizard, expand the Standard folder and select Implementation link and stub.
  5. Click OK to complete the stub implementation. The inheritance link is created and the stubs for the inherited methods are generated in the source class.

To create an inheritance stub using the Node by Pattern command

  1. Open a class diagram in the Diagram View.
  2. On the Tool Palette, click Node by Pattern.
  3. Select the source class on the diagram. The Pattern Wizard opens.
  4. In the Pattern Wizard, expand the Standard folder, and select Implementation link and stub.
  5. In the Pattern Properties pane, click the Supplier property and click the button to the right of the Supplier property. The Select Supplier dialog box opens.
  6. Select the destination class or interface from the tree of available model elements and click OK.
  7. Click OK to complete the stub implementation and close the Pattern Wizard. The inheritance link is created and the stubs for the inherited methods are generated in the source class.

To create an inheritance link using the Create by Pattern context menu command

  1. Open a class diagram in the Diagram View.
  2. Right-click the source class on the diagram and choose Create by Pattern from the context menu. The Pattern Wizard opens.
  3. In the Pattern Wizard, expand the Standard folder and select Implementation link and stub.
  4. In the Pattern Properties pane, click the Supplier property and click the button to the right of the Supplier property. The Select Supplier dialog box opens.
  5. Select the destination class or interface from the tree of available model elements and click OK.
  6. Click OK to complete the stub implementation and close the Pattern Wizard. The inheritance link is created and the stubs for the inherited methods are generated in the source class.
Note: You can find the Stub implementation pattern on the context menu of classes that inherit from an interface or an abstract class. This pattern is also available in the Pattern Wizard by clicking the Node by Pattern button in the Tool Palette, or by using the Create by Pattern context menu for a class. Use the Stub implementation pattern if you already have an inheritance/generalization link drawn on the diagram and you want to copy the methods to the derived class.

To create a stub implementation using the Stub Implementation context menu command

  1. Right-click a class that inherits from an interface or an abstract class.
  2. Choose Stub Implementation from the context menu.


See Also