Data Type

A data type is a classifier - similar to a class - whose instances are "identified only by their value".

A typical use of data types would be to represent value types from business domain, primitive types or structured types of a programming language. For example, date/time, gender, currency, address could be defined as data types. All copies of an instance of a data type and any instances of that data type with the same value are considered to be equal instances.

A data type is shown using rectangle symbol with keyword «dataType».

Data type shown as rectangle symbol with keyword dataType - DateTime.

DateTime data type

A data type may contain attributes and operations to support the modeling of structured data types. Instances of a structured data type are considered to be equal if the structure is the same and the values of the corresponding attributes are equal.

Structured data type shown with atributes - Address.

Structured data type Address

When data type is referenced by, e.g., as the type of a class attribute, it is shown simply as the name of the data type.

Attributes of the Patient class are of data types Name, Gender, DateTime, Address and Visit.

Attributes of the Patient class are of data types Name, Gender, DateTime, Address and Visit.

Primitive Type

A primitive type is a data type which represents atomic data values, i.e. values having no parts or structure. A primitive data type may have precise semantics and operations defined outside of UML, for example, mathematically.

Standard UML primitive types include:

Instances of primitive types do not have identity. If two instances have the same representation, then they are indistinguishable.

A primitive type has the keyword «primitive» above or before the name of the primitive type.

Primitive data type Weight.

Primitive data type Weight.

Enumeration

An enumeration is a data type whose values are enumerated in the model as user-defined enumeration literals.

An enumeration may be shown using the classifier notation (a rectangle) with the keyword «enumeration». The name of the enumeration is placed in the upper compartment. A compartment listing the attributes for the enumeration is placed below the name compartment. A compartment listing the operations for the enumeration is placed below the attribute compartment.

A list of enumeration literals may be placed, one to a line, in the bottom compartment. The attributes and operations compartments may be suppressed, and typically are suppressed if they would be empty.

Enumeration AccountType.

Enumeration AccountType.

Next  Property