Architecting and designing : UML 2.0 Lite : UML models : UML class diagrams : Class attribute
  
Class attribute
Attributes of a class are displayed in the second compartment of a UML class symbol. Attributes can be displayed with a visibility (see Visibility), and an initial value.
Type
A class attribute must have a type. A type declares how the attribute must be treated. There are two basic types:.
Primitive types
Every language (Java, C++, Visual Basic, CORBA IDL, etc) has a standard set of primitive types. In the Type property of an attribute, you are provided with a filtered list that shows simply the primitive types of the language declared for that class.
Reference types
Reference types are class types, interface types, and array types. To select a reference type, place your cursor in the type cell for an attribute, right-mouse click, and select Choices. You are provided with a dialog that presents all classes in the encyclopedia, which you may select and drag into the class attribute's type cell.
Pre-type
const
Specifies that a parameter is a constant.
Volatile
Specifies that the variable is vulnerable to thread access. It is read from memory each time it is used and stored to memory after each occasion, to ensure data integrity. You cannot declare a variable to be both final and volatile.
ByRef
Specifies that the caller can modify the variable's value. The syntax is: ..., ByRef parameter, ... Used primarily in the VB language.
Optional ByRef
Specifies that a parameter is optional, and it is passed by reference. Used primarily in the VB language.
ByVal
Specifies that a parameter is passed by value rather than by reference. This implies that the caller cannot modify that variable's value. The syntax is: ..., ByVal parameter, ... Used primarily in the VB language.
Optional ByVal
Specifies that a parameter is optional, and it is passed by value. Used primarily in the VB language.
Post-type
*
Specifies that a variable is passed by pointer. Used in the C++ language.
**
Specifies that a variable is passed by a pointer to a pointer. Used in the C++ language.
&
Specifies that a variable is passed by reference.
()
Specifies that a parameter is passed by value. The syntax is: ..., (parameter), ... An example is: ShowDialog (i), which calls a function ShowDialog and passes it the variable 'i', by value.
Volatile
Specifies that the variable is vulnerable to thread access. It is read from memory each time it is used and stored to memory after each occasion, to ensure data integrity. You cannot declare a variable to be both final and volatile.
* Const
Specifies that a parameter is a constant and passed by pointer. Used in the C++ language.
** Const
Specifies that a parameter is a constant and passed by a pointer to a pointer. Used in the C++ language.
& Const
Specifies that a parameter is a constant passed by reference. Used in the C++ language.
* Volatile
Specifies that a parameter is volatile and passed by pointer. Used in the C++ language.
** Volatile
Specifies that a parameter is volatile and passed by a pointer to a pointer. Used in the C++ language.
& Volatile
Specifies that a parameter is volatile and passed by reference.
Derived
You may specify that the attribute is derived from a superclass.
Source data
In System Architect you may map a Class diagram to a Logical ER diagram. However, the Logical ER diagram knows only of generic ANSI data types. System Architect will automatically map the data types of the target language of the class attribute (ie, Java, C++, etc) to the best equivalent ANSI-generic data type. If this mapping is not sufficient, you may also specify, for each class attribute, an underlying data element. This data element can have an ANSI-generic data type specified. When mapping the class diagram to a data model, if a class attribute has an underlying data element specified, it will be the data element that will be mapped to the ER diagram.
PK
Specifies that the attribute is a primary key. This is an extension to UML modeling, and is used when mapping the class to a data model.
See also
UML class diagrams