Chapter 3 Building Structural Diagrams


Creating generic types

PowerDesigner allows you to designate classes and interfaces as generic types.

You define a list of type variables that will be used as datatypes for attributes, method parameters, or return types. PowerDesigner requires the existence of a bound class to create a generalization, realization, or association.

You then bind a classifier to the generic type via this intermediate bound class, and specify the actual types to be used in place of the required type variables.

Steps To designate a class or interface as a generic type:

  1. Open the property sheet of the class or interface, and select Generic from the Type list on the General tab. The Generic tab will be automatically displayed, and a type variable created in the list in the tab.
  2. Click the Generic tab, and add any additional type variables that you require with the Add a Row tool. You can also specify a derivation constraint in the form of a list of types.
  3. Click OK to return to the diagram. The classifier symbol will now display the type variables on its top-left corner.

In order for the classifier to become a true generic type, it must contain at least one generic method.

 


Copyright (C) 2006. Sybase Inc. All rights reserved.