Creating a Specialized Classifier

If you need to create a classifier that will inherit from a generic type, you must create an intermediary bound classifier. The Generic Classifier Specialization Wizard can perform these steps for you.

  1. Right-click a generic class or interface, and select Create Specialized Class (or Interface) from the contextual menu to open the Generic Classifier Specialization Wizard:

  2. Enter a Name and Code for the specialized classifier, and then click Next to go to the type parameters page.
  3. Specify values for each of the type parameters in the list. If you do not specify a value for a type parameter, it will be added as a type parameter to the new specialized classifier.
  4. Click Finish to return to the diagram. The wizard will have created the specialized classifier and also a bound classifier which acts as an intermediary between the generic and the specialized classifiers, in order to specify values for the type parameters.

    The bound classifier is attached to the generic classifier via a dependency with a stereotype of <<bind>>, and acts as the parent of the specialized classifier, which is connected to it by a generalization.

    In the example below, SpecializedClass inherits from GenericClass via GenericClass_Bound, which specifies type parameters for the generic types T, T_2, and T_3.



    At compile time, the specialized classifier can inherit the methods and properties of the generic classifier, and the generic type variables will be replaced by actual types. As a result, the compiler will be able to provide stronger type checking and automatic casting of the associated return values.


Created October 7, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com