Tuesday, April 27, 2021

Add or edit uml element attributes

You can add or edit attributes of UML elements.

Add an attribute

  1. Double-click the shape in a diagram that represents the element.

    The Properties dialog box opens.

  2. Select a blank row and start typing a name, then type or choose the attribute properties you want.

  3. With that row still selected in the attribute table, select Properties.

  4. Edit the properties as needed:

    Property

    Description

    Name

    Type or edit an identifier string as a name for the attribute. Typically, attribute names begin with a small letter, for example, maximum-size or color.

    Stereotype

    Choose the stereotype you want from the drop-down list. If a stereotype you want to use isn't listed, you can add a new stereotype or edit an existing one by clicking Stereotypes on the UML menu.

    Prefix

    Type any language-specific annotation text here you want to use to further identify an attribute.

    Suffix

    Type any language-specific annotation text here you want to use to further identify an attribute.

    Type

    Choose an implementation type for the attribute. After you select a type, the Prefix, Suffix, and Expression fields become available to edit.

    If the data type you want isn't listed, right-click a data types package in the tree view in the Model Explorer, point to New and then choose DataType, or create a new class.

    Expression

    Displays the result of data you've added under Prefix, Type, and Suffix.

    Visibility

    Choose the visibility (public, private, or protected) that applies to the attribute. Public means the attribute is publicly available to any class. Protected means the attribute is available inside the class and to its subclasses. Private means that the attribute can only be used inside the class.

    Multiplicity

    Choose the possible number of data values that can be held by an instance. If the multiplicity is 1, then the attribute holds exactly one value.

    InitialValue

    Type the value of the attribute upon initialization.

    Changeable

    Indicates whether the attribute value can be modified after the element is created. None means no restrictions on modification. Frozen means the value can't be altered after the element and its values are instantiated. AddOnly is meaningful only when the multiplicity is not fixed to a single value. It means that additional values can be added but, once added, cannot be removed or altered.

    OwnerScope

    Choose Instance if each object created by the class has its own value of the attribute. Choose Classifier for owner scope if the attribute value is owned by the class itself. A classifier-scope attribute is underlined.

    TargetScope

    Choose Instance if the attribute value is an instance of its data type. Choose Classifier for target scope if the attribute value is the type itself.

    Documentation

    Type any documentation you want to add to the element as a tagged value. When you select the shape or icon representing the element, the documentation you type here also appears in the Documentation window.

Edit an attribute

  1. Select the attribute you want to edit.

  2. Select the Properties button.

  3. Edit any of the properties in the dialog box.

Note: The UML Model Explorer is not available in Visio 2013 and newer versions. For information on UML diagrams in Visio 2013 and newer versions, see UML diagrams in Visio.

See Also

Delete attributes from a UML element

No comments:

Post a Comment