SE450: UML Class Diagrams: Classes [14/18] ![]() ![]() ![]() |
Notation:
Top is the class name (required)
Fields (attributes in UML) in the middle. Two types of syntax: Java or UML.
Java Syntax: [Visibility] [Type] Name [[Multiplicity]] [= Initial Value]
UML Syntax: [Visibility] Name [[Multiplicity]] [:Type] [= Initial Value]
Methods (operations in UML) on the bottom. Two types of syntax: Java or UML.
Java Syntax: [Visibility] [Type] Name ([Parameter,...])
UML Syntax: [Visibility] Name ([Parameter,...]) [:Type]
Visibility can be one of
public
)private
)protected
)Parameters in UML are given Name:Type, in Java Type Name
Class Diagrams can be given in abbreviated forms
Static is indicated by underlining the method
Stereotypes are used to extend the UML. It is like an adjective to describe a core UML type and make it better understood when there is not UML type to describe exactly the role you are assigning a part of your model
Interfaces are drawn as a stereotype of a class (older versions will show a circle)
Constructors can be distinguished from other methods by using a Constructor stereotype
Ellipsis (...) are used to show that more methods or variables exist that aren't shown