When you click the Invoke Feature Dialog button or double-click
an attribute, the Attribute window opens. This
window is also displayed when you select an attribute in the browser
and might have different options than shown in here.
About this task
On the General tab,
you define the general features for an attribute through the various
controls on the tab.
- In the Name field you specify
the name of the attribute. The default name is attribute_n,
where n is an incremental integer starting with 0. To enter a detailed
description of the attribute, use the Description tab.
- You use the L button to
open the Name and Label window to specify the
label for the element, if any.
- In the Stereotype list you
specify the stereotype of the attribute, if any.
- To select from a list of current stereotypes in
the project, click the Select Stereotype button
.
- To sort the order of the selected stereotypes,
click the Change Stereotype Order button
. Note: The COM stereotypes are constructive;
that is, they affect code generation.
- In the Attribute type area
you specify the attribute type. There are two ways to specify the
type:
- Select the Use existing type check
box to select a predefined or user-defined type or class. Use the Type list
to select from among the IBM® Rational® Rhapsody® predefined
types, and any types and classes you have created in this project.
Or to define a new type, delete the value in the Type list
box to enable the Invoke Feature Dialog button
and click it to open the Type window.
- Clear the Use existing type check
box if there is no defined type. A C++[Java] Declaration box
displays in which you can give the attribute a declaration appropriate
for your language edition.
- In the Visibility area you
specify the type of access (visibility) for the accessor/mutator generated
for the attribute: Public, Protected, or Private.
When you generate code, each attribute is generated into three entities: - The data member itself
- An accessor (get) method for retrieving
the data value
- A mutator (set) method for setting
the data value
Note: The visibility setting affects
only the visibility of the accessor and mutator methods, not of the
data member itself. The data member is always protected, regardless
of the access setting.
- In the Multiplicity field
(displayed when appropriate) you specify the multiplicity of the attribute.
If this number is greater than 1, use the Ordered check box
to specify whether the order of the reference type items is significant.
The modifier choices are as follows:
- Constant specifies whether the attribute
is read-only (check box is selected) or modifiable (check box is cleared).
- Reference specifies whether the attribute
is referenced as a reference, such as a pointer (*)
or an address (&) in C++.
- Static creates a static attribute, which
belongs to the class as a whole rather than to individual objects.
- In the Initial Value box you specify the
initial value for the attribute.