Dependency relationships
In Unified Modeling Language (UML) visualization class diagrams, a dependency relationship indicates that a change to one class (the supplier) might cause a change in the other class (the client). The supplier is independent because a change in the consumer does not affect the supplier.
For example, a Cart class depends on a Product class because the Product class is used as a parameter for an add operation in the Cart class. In a class diagram, a dependency relationship points from the Cart class to the Product class. In other words, the Cart class is the consumer element, and the Product class is the supplier element. A change to the Product class may cause a change to the Cart class.
In UML class diagrams, dependency relationships in a Java application connect two classes to indicate that there is a connection between the two classes, and that the connection is more temporary than an association relationship. A dependency relationship indicates that the consumer class does one of the following things:
- Temporarily uses a supplier class that has global scope
- Temporarily uses a supplier class as a parameter for one of its operations
- Temporarily uses a supplier class as a local variable for one of its operations
- Sends a message to a supplier class
Enterprise JavaBeans (EJB) references are visualized as stereotyped dependency relationships.
A dependency relationship connector appears as a dashed line with an open arrow that points from the client class to the supplier class.
Java source code UML visualization
![]()
![]()
Parent topic
Relationships
Related concepts
Association relationships
Extends relationships
Implements relationships
Owned element association relationships
Related tasks
Showing related Java elements
Showing related Java elements based on outgoing relationships
Showing related Java elements based on incoming relationships