Using Classifiers

Return to Introduction  Previous page  Next page

Objects that support classifiers have the Advanced | Instance Classifier menu option in the Diagram View context menu. Select this option to choose a single class as the classifier or template for this object.

When you do this, the object name is displayed as Object : Class; for example a Person object named Joe Smith is displayed as Joe Smith : Person.

Several Changes Occur if an Object has a Classifier

In the context menu for the object, the Element Features | Attributes and Element Features | Operations menu options display. If you select either of these, the Attributes or Operations dialog displays for the classifier, not the object. It is important to remember that the object is only an instance of a class at runtime, so the appropriate attributes and operations are those of the classifier, not the object.

If you set the classifier for an object in a Sequence diagram, when you add a message the drop-down list of available messages derived from the target object come from the classifier, not the object selected. This enables you to associate Sequence diagram objects with classes and use the defined behavior of the class to model actual behavior at run time.

You can also select a message for a state flow connector. The same rules apply as for sequence objects.

Note that in the Message dialog you can also elect to include messages defined in the target classifiers inheritance hierarchy.

The Set Element Classifier dialog is shown below. Select the required item in the list and click on the OK button to set the instance classifier.

SelectClassifier2