Class)
 
Class (Fig A) is the blueprint of an object, which contains three components. The first is the class name defined in Java. The second is attributes ). The third is the method provided by this class.
 
 
You can append a visibility modifier before attributes and operations. The plus sign (+) indicates public visibility. Minus (-) indicates private visibility. # Indicates protected visibility. Omit these modifiers to indicate that
Package-level visibility. If an attribute or operation has an underscore, it indicates that it is static. In the operation, you can also list the parameters it accepts and the return type, A's "Java"
Area.
 
Figure
 
  
 
Package)
 
 
Package (Figure B) is a combination mechanism for common purposes. A package in UML corresponds directly to a package in Java. In Java, A package may contain other packages, classes, or both. Into
You usually have a logical package during row modeling. It is mainly used to organize your model. You will also have a physical package, which is directly converted into a Java package in the system. The name of each package
Unique identifier.
 
Figure B
 
  
 
Interface)
 
An interface (Figure C) is a collection of operations that specify the services provided by a class. It directly corresponds to an interface type in Java. The interface can be represented by the icon in Figure C or a standard class attached with <>. Generally, you can know the relationship with other classes based on the interface in the class diagram.
 
Figure C
 
  
 
 
 
Link
 
The following examples show various relationships for a specific purpose. Although the syntax is correct, these examples can be further refined to include more semantics within their effective scope.
 
Dependency)
 
 
An "use" Relationship between entities implies that when the specification of an object changes, other instances dependent on it may be affected (Figure D ). More specifically, it can be converted to a class or pair that is not in the scope of the instance.
Any type of references. This includes a local variable, a reference to an object obtained through method call (as shown in the following example), or a reference to a static method of a class (at the same time,
Instances ). You can also use "dependency" to indicate the relationship between packages. Because the package contains classes, you can express the relationship between packages and packages based on the relationships between classes in those packages.
 
Figure D
 
  
 
Association)
 
 
A structured relationship between objects indicates that objects are connected to each other. The arrow is optional and is used to specify the navigation capability. Without arrows, it implies a two-way navigation capability. In Java, join (figure
E) convert to an instance scope variable, as shown in the code in the "Java" Area in Figure E. You can append other modifiers to an association. Multiplicity Modifier
It implies the relationship between instances. In the Demo code, the employee can have 0 or more timecard objects. However, each timecard belongs to only one
Employee.
 
Figure E
 
  
 
Aggregation)
 
Aggregation (Fig F) is a form of association, representing the overall/local relationship between two classes. Aggregation implies that the whole is at a level higher than the local level, while association implies that two classes are at the same level in concept. Aggregation is also converted to an instance scope variable in Java.
 
 
 
The difference between Association and aggregation is purely conceptual and strictly reflected in semantics. Aggregation also implies that there is no loop in the instance diagram. In other words, it can only be a unidirectional link.
 
Figure F
 
  
 
Composition)
 
 
Synthesis
(Figure G) is a special form of aggregation, which implies the lifetime responsibilities of "local" within "Overall. Synthesis is not shared. Therefore, although local data may not be destroyed as a whole
Maintain local survival or destroy it. It cannot be shared with other entities. However, ownership can be transferred to another object as a whole, and the latter will assume the responsibility for survival.
 
Class)
 
Class (Fig A) is the blueprint of an object, which contains three components. The first is the class name defined in Java. The second is attributes ). The third is the method provided by this class.
 
 
You can append a visibility modifier before attributes and operations. The plus sign (+) indicates public visibility. Minus (-) indicates private visibility. # Indicates protected visibility. Omit these modifiers to indicate that
Package-level visibility. If an attribute or operation has an underscore, it indicates that it is static. In the operation, you can also list the parameters it accepts and the return type, A's "Java"
Area.
 
Figure
 
  
 
Package)
 
 
Package (Figure B) is a combination mechanism for common purposes. A package in UML corresponds directly to a package in Java. In Java, A package may contain other packages, classes, or both. Into
You usually have a logical package during row modeling. It is mainly used to organize your model. You will also have a physical package, which is directly converted into a Java package in the system. The name of each package
Unique identifier.
 
 
 
Figure B
 
  
 
Interface)
 
An interface (Figure C) is a collection of operations that specify the services provided by a class. It directly corresponds to an interface type in Java. The interface can be represented by the icon in Figure C or a standard class attached with <>. Generally, you can know the relationship with other classes based on the interface in the class diagram.
 
Figure C
 
  
 
Link
 
The following examples show various relationships for a specific purpose. Although the syntax is correct, these examples can be further refined to include more semantics within their effective scope.
 
Dependency)
 
 
An "use" Relationship between entities implies that when the specification of an object changes, other instances dependent on it may be affected (Figure D ). More specifically, it can be converted to a class or pair that is not in the scope of the instance.
Any type of references. This includes a local variable, a reference to an object obtained through method call (as shown in the following example), or a reference to a static method of a class (at the same time,
Instances ). You can also use "dependency" to indicate the relationship between packages. Because the package contains classes, you can express the relationship between packages and packages based on the relationships between classes in those packages.
 
Figure D
 
  
 
Association)
 
 
A structured relationship between objects indicates that objects are connected to each other. The arrow is optional and is used to specify the navigation capability. Without arrows, it implies a two-way navigation capability. In Java, join (figure
E) convert to an instance scope variable, as shown in the code in the "Java" Area in Figure E. You can append other modifiers to an association. Multiplicity Modifier
It implies the relationship between instances. In the Demo code, the employee can have 0 or more timecard objects. However, each timecard belongs to only one
Employee.
 
 
 
Figure E
 
  
 
Aggregation)
 
Aggregation (Fig F) is a form of association, representing the overall/local relationship between two classes. Aggregation implies that the whole is at a level higher than the local level, while association implies that two classes are at the same level in concept. Aggregation is also converted to an instance scope variable in Java.
 
The difference between Association and aggregation is purely conceptual and strictly reflected in semantics. Aggregation also implies that there is no loop in the instance diagram. In other words, it can only be a unidirectional link.
 
Figure F
 
  
 
Composition)
 
 
Synthesis
(Figure G) is a special form of aggregation, which implies the lifetime responsibilities of "local" within "Overall. Synthesis is not shared. Therefore, although local data may not be destroyed as a whole
Maintain local survival or destroy it. It cannot be shared with other entities. However, ownership can be transferred to another object as a whole, and the latter will assume the responsibility for survival.
 
The relationship between employee and timecard may be more suitable for "merging", rather than "associating ".
 
Figure G
 
  
 
Generalization)
 
Generalization (Figure H) indicates the relationship between a more generalized element and a more specific element. Generalization is a UML element used to model inheritance. In Java, the extends keyword is used to directly represent this relationship.
 
Figure H
 
  
 
Implementation)
 
The instance (figure I) relationship specifies a contract between two entities. In other words, one entity defines a contract, and the other entity guarantees the performance of the contract. When modeling a Java application, the implementation relationship can be expressed directly by the implements keyword.
 
Figure I
 
  
 
Precise ing
 
As described in this article, elements on the UML class diagram can be precisely mapped to the Java programming language. Developers can use this accuracy to enhance communication and reach consensus on system structural design.