Attribute is a named slot within a class (or other
Classifier
) describing a range of values that may be
held by instances of the class. In the UML metamodel it is a sub-class of
StructuralFeature
which is itself a sub-class of
Feature
.
An attribute is represented on a single line within the attribute compartment of the class. Its syntax is as follows:
visibility attributeName
:
type [=
initialValue]
visibility is +
,
#
or -
corresponding to
public
, protected
or
private
visibility respectively.
In addition any attribute declared static will have its whole entry underlined on the diagram.
attributeName is the actual name of the attribute being declared.
type is the type (UML datatype, class or interface) declared for the attribute.
initialValue is any initial value to be given to the attribute when an instance of the class is created. This may be overridden by any constructor operation.
The details tabs that are active for attributes are as follows.
ToDoItem
Standard tab.
Properties
See Section 17.6.2, “Attribute Property Toolbar” and Section 17.6.3, “Property Fields For Attribute” below.
Documentation
Standard tab. See Section 12.5, “Documentation Tab”.
Source
Standard tab. This contains a declaration for the attribute.
Constraints
Standard tab. There are no standard constraints
defined for Attribute
within the UML
metamodel.
Tagged Values
Standard tab.
In the UML metamodel,
Attribute
has the following standard tagged
values defined.
transient
.
volatile
.
This is an ArgoUML extension to the UML 1.3 standard
to indicate that this attribute is realized in
some volatile form
(for example it will be a memory mapped control register).
![]() | Note |
---|---|
The UML |
Go
up
Navigate up through the package structure.
New
attribute
This creates a new attribute within the owning class of the current attribute, navigating immediately to the properties tab for that attribute.
![]() | Tip |
---|---|
This is a very convenient way to add a number of attributes, one after the other, to a class. |
Delete
This deletes the attribute from the model
![]() | Warning |
---|---|
This is a deletion from the model not just the diagram. If desired the whole attribute compartment can be hidden on the diagram using the style tab (see Section 17.6.2, “Attribute Property Toolbar”) or the button 2 pop up menu for the class on the diagram. |
Name
Text box. The name of the attribute. The name of a attribute has a leading lower case letter, with words separated by “bumpy caps”.
![]() | Note |
---|---|
The ArgoUML critics will complain about attribute names that do not have an initial lower case letter. |
Stereotype
Drop down selector. There are no UML standard
stereotypes for Attribute
.
Navigate Stereotype
icon. If a
stereotype has been selected, this will navigate to the
stereotype property panel (see Section 15.4, “Stereotype”).
Owner
Text box. Records the class which contains this attribute.
Button 1 double click on the entry will navigate to the class.
Multiplicity
Drop down selector. The default (empty) value is that there is one instance of this attribute for each instance of the class, i.e. it is a scalar. The drop down provides a number of specifications for non-scalar attributes.
![]() | Note |
---|---|
The selection |
![]() | Caution |
---|---|
ArgoUML restricts you to a number of predefined ranges for multiplicity. There is no way to give a user defined range. |
Type
Drop down selector.
The type of this attribute.
This can be any UML Classifier
, although in
practice only
Class
,
DataType
, or
Interface
make any sense.
![]() | Note |
---|---|
A type must be declared (it can be
|
Navigate Type
icon. This will
navigate to the property panel for the currently selected
type. (see Section 17.5, “Class”, Section 17.3, “Datatype” and Section 17.15, “Interface”).
Initial Value
Text box with drop down.
This allows you to set an initial value for the attribute if desired
(this is optional).
The drop down menu provides access to the common values
0
,
1
,
2
, and
null
.
![]() | Caution |
---|---|
Any constructor operation may ignore this initial value. |
![]() | Warning |
---|---|
This function is broken in V0.14 of ArgoUML. The textbox is not editable, and if an initial value is given in the diagram (by editing the attribute definition string), then something like: “ru.novosoft.uml.foundation.data_types.MExpression@1b6484c” appears. |
Visibility
Radio box, with entries
public
,
protected
, and
private
.
public
. The attribute is
available to any artifact that can see the owning
class.
private
. The attribute is
available only to the owning class (and any inner
classes).
protected
. The attribute is
available only to the owning class, or artifacts that are
subclasses of the owning class.
Changeability
Radio box, with entries
changeable
,
add only
, and
frozen
.
changeable
.
There are no restrictions of modification.
add only
.
Meaningful only if the multiplicity is not fixed to a
single value. Additional values may be added to the set of
values, but once created a value may not be removed or altered.
frozen
.
Also named “immutable”.
The value of the
attribute may not change during the lifetime of the owner class.
The value must be set at object creation, and may never change
after that. This implies that there is usually an argument for
this value in a constructor and that there is no operation that
updates this value.
Static
Check box for static
.
If unchecked (the defaults) then the attribute has “instance
scope”. If checked, then the attribute is static, i.e. it
has “class scope”. Static attributes are indicated on
the diagram by underlining.