Links in a class diagram refer to the relationships between classes, classes, and interfaces, and between interfaces.
Link:
1. General Relationship: Generalization
Applicable to: classes, classes, and interfaces; between interfaces
It indicates the inheritance relationship.
Symbol: a hollow triangle points to the parent class by a subclass, or a class points to an interface.
Implementation in Java: implements, extends
2. Association: Association
Applicable to: between classes
Indicates the connection between classes, so that one class knows the attributes and methods of the other class.
Symbol:Solid line.There are arrows and base multiplicity. Tables can have several instances. Direction available, one-way, two-way
JAVA Implementation: pointing to an instance variable in the class that is directed to the class
3. Aggregation: Aggregation
Applicable to: between classes
Indicates the connection between classes, so that one class knows the attributes and methods of the other class.+ Relationship between the table and individual.
Symbol:Solid line.There are arrows and base multiplicity. Tables can have several instances. Direction available, one-way, two-way +The arrow pointing to the class is a hollow triangle.
JAVA Implementation: pointing to an instance variable in the class that is directed to the class
Others: stronger Association
4. compositing relationship: composition
applicable to: Class and Class
meaning: indicates the connection between classes, so that one class knows the attributes and methods of the other class. + relationships between the table and individual. + indicates that the entire object represents the lifecycle of some objects.
Symbol: solid line. There are arrows and base multiplicity. The table can have several instances. Direction available, one-way, two-way + the arrow pointing to the class is a solid triangle.
JAVA Implementation: pointing to a class with an instance variable pointing to the class
others: 1. stronger aggregation Relationship 2. at any time, some objects can only combine with one whole object. 3. the compositing link cannot be shared!
5. dependency: dependency
applicable to: between classes
meaning: indicates that one class depends on the definition of another class.
Symbol: dotted line. There are arrows and base multiplicity. The table can have several instances. Direction available, one-way, two-way
JAVA Implementation: 1. local variable, 2. parameters of the method, 3. call a static method
others: Dependency: dependency and dependency: association: whether the class is a local variable or an instance variable