Work with classes and objects in UML static structure diagrams
Add an interface to a class, component, or other element
-
In a static structure, component, or deployment diagram, drag the lollipop Interface shape (represented by a line and circle) onto the drawing page.
-
Glue the endpoint without the circle to a connection point on the class component, or other element.
-
Double-click the Interface shape to add a name, operations, and other property values.
Tip: You can also represent an interface with a rectangular Interface shape that resembles a class. Use this shape when you want to display a list of the interface operations.
Tip: To change the type of shape that appears for an interface, right-click the Interface shape and click Show as Class-like Interface or Show as Lollipop Interface.
Indicate a realizes relationship between a class and an interface or other element
-
In a static structure diagram, right-click any class shape (Class, Parameterized Class, Utility or MetaClass), click Shape Display Options, and then, under General Options, select Realization Link.
-
Glue the control handle for the realization link on a class shape to a connection point on the interface, class, or other element.
Add receptions to a classifier
-
Double-click the shape representing the classifier you want to add receptions to, and then click the Receptions category.
-
Click New to add a new reception.
-
Click the Reception category. Type a name for the reception in the Reception column. In the Signal column, choose the signal to which the classifier, prepared by the reception, reacts, and then choose the other property values you want.
Note: A signal element must exist in the model for it to be available in the Signal list.
-
In the Exceptions category, choose the exceptions, if any, that can be generated by the reception.
Note: An exception element must exist in the model for it to be available in the Signal list.
-
Add any constraints or tagged values you want, and then click OK until you close the shape's UML Properties dialog box.
Add template parameters to a class
-
Double-click the shape (Parameterized Class, Class, Utility, Metaclass, or Bound Element) representing the element that you want to add parameters to, and then click Template Parameters.
-
Click New to add a new parameter.
-
In the Template parameters list:
-
To edit an existing parameter, type a new name in the Template Parameter column.
-
To edit the type, click a Type field, click the arrow, and then select the type from the list.
-
To add documentation, type in the Documentation box.
-
-
Click OK to accept the changes and close the UML Class Properties dialog box.
Tip: You can make any class a parameterized class by adding parameters to a class shape. To hide parameters on any class shape, right-click the shape, click Shape Display Options and then, under Suppress, select Template Parameters.
Bind template parameters to a class
-
Drag a Bound Element shape from the UML Static Structure stencil onto the drawing page near the Parameterized Class shape with parameters you want to bind.
-
Drag a Binding shape onto the drawing page and glue the endpoint without an arrowhead to a connection point on the bound element.
-
Glue the Binding endpoint with an arrowhead to a connection point on the Parameterized Class shape.
-
Double-click the Binding shape, and then click Bound Arguments.
-
Under Bound Arguments, select a parameter to which you want to bind a type (if the parameter has no type specified) or select a value (if the parameter has a type specified). Click Properties, choose the type or type the value you want, and then click OK.
-
Click OK to close the UML Binding Properties dialog box.
Attributes and operations associated with the parameterized class are passed to the bound element. Unbound parameters (with no specified type) that you have assigned to the class as attribute types or operation return types, are replaced in the bound element by the types you specified in step 5 above.
Create an object as an instance of a class
-
In a static structure diagram, drag a Class shape onto the drawing page to represent the class you want the object to be an instance of.
-
Optional Double-click the Class shape to open the UML Class Properties dialog box. Click Attributes, and then click New to add attributes to the class. Click OK, and then click OK again.
-
Drag an Object shape onto the drawing page, and then double-click the shape.
-
In the UML Object Properties dialog box, click Object and type a name for the object. Under Class, select the class you want the object to be an instance of.
-
Click Attribute Values and select the attribute you want to add an instance value to, and then click Properties. Type a value for the attribute.
-
Click Attribute Link, add any other property values you want, and then click OK.
-
Repeat steps 5 and 6 for all the attributes you want to add instance values to, and then click OK.
Delete template parameters from a class
-
Double-click the shape (Parameterized Class, Class, Utility, Metaclass, or Bound Element) representing the element with parameters you want to delete, and then click Template Parameters.
-
Select the template parameter you want to delete, click Delete, and then click OK.
Edit template parameters for a class
-
Double-click the shape (Parameterized Class, Class, Utility, Metaclass, or Bound Element) representing the element with the parameters you want to edit, and then click Template Parameters.
-
In the Template parameters list, for each parameter you want to edit, click a Type field. Then, click the arrow and select a type from the list.
Note: You can assign parameters with no type specified to attributes as types or to operations as return types.
-
In the Template parameters list, for each parameter that you want to edit, type a new name.
-
In the Documentation box, type the documentation you want.
-
Click New to add another parameter (and follow steps 3 through 5), or click OK to close the UML Class Properties dialog box.
Hide the attribute and operations sections of a class
-
Right-click the Class shape, and then click Shape Display Options.
-
In the UML Shape Display Options dialog box, under Suppress, select Attributes to hide the attributes section, and then select Operations to hide the operations section.
Tip: To show the attributes and operations sections again, right-click the shape, click Shape Display Options, and then clear Attributes and Operations.
Indicate that classes in a package may be referenced
-
In a package diagram, drag a Dependency shape onto the drawing page.
-
Glue the Dependency endpoint without an arrowhead to a connection point on the package that will reference the classes in another package.
-
Glue the Dependency endpoint with an arrowhead to a connection point on the package that contains the target classes that will be referenced.
-
Double-click the Dependency shape to open the UML Dependency Properties dialog box.
-
Under Name, type a name for the dependency. Under Stereotype, choose Import, and then click OK.
Note: Connecting packages with an <<import>> dependency only indicates that classes can be referenced. You still need to set the appropriate visibility for the target classes.
Show the implementation of a type by an implementation class
-
In a static structure diagram, drag a Class shape onto the drawing page. Double-click the shape.
-
In the UML Class Properties dialog box, click Class and type a name for the class. Under Stereotype, choose Type, and then click OK.
-
Drag a second Class shape onto the drawing page. Double-click the shape.
-
In the UML Class Properties dialog box, click Class and type a name for the class. Under Stereotype, choose Implementation Class, and then click OK.
-
Right-click the implementation class and click Shape Display Options. In the UML Shape Display Options dialog box, under General Options, select Realization Link, and then click OK.
-
Drag the control handle on the implementation class shape to create a connector representing a realizes relationship.
-
Glue the endpoint on the realization connector arrowhead to a connection point on the Class shape representing the type.
No comments:
Post a Comment