Home > Preferences > Class Diagram

Dependency

Dependencies can be customized from the preferences (UML > Class Diagram > Dependency).

Different options are available:

1. The Stereotype area:

        Either show or not show the stereotype on dependencies

        Select stereotype priorities for class dependencies

EclipseUML will just show one stereotype on a class dependency, even if a class dependency could have more than one stereotype. We will therefore have to select a priority order within the six kinds of stereotype. This priority order will decide which stereotype will be shown.
The six kinds of stereotype are (considering two elements A and B):

2. Dependency definition area

This preference allows you to define the dependency relationships:

Options

Stereotypes

Description

Class reference

«access»

Access directly class attributes and call static methods.

«instantiate»

Create an instance

Variable type

«access»

All variable types used in a class/interface such as attribute type, method argument type, method return type and local variable type.

Method call

«call»

Invoke an instance method

Inheritance (super)

«derive»

Specification or implementation of one type

 

This definition is used to detect the dependency relationships once a Java class is modified.

Class reference

Direct class attribute access

public class Category
{
static public Category software = new Category(); } public class Company { Object category = Category.software; }

Instance creation

 public class Category

{
} public class Company { Object category = new Category(); } 

Variable type

Attribute type

 

public class Category {
}

public class Company { Category category; }

Method argument type

 

public class Category
{

static public Category software = new Category(); } public class Company { Object category; public void setCategory(Category category) {
this.category = category; } }

Method return type

 public class Category

{
} public class Company { Object category; public Category castCategory() {
return (Category) category; } }

Local variable type

 

 public class Category

{
} public class Company { Object category; public void init() {
Category defaultCategory = null; this.category = defaultCategory; } }

Method Call

            The dependency based on the method call is setup between the caller and the method declaration class.

 public class Category

{
String name; String getName() {
return name; } } public class Company { Category category; public String toString() {
return category.getName(); }
}

The following example doesn’t fit this condition since the method toString() isn’t defined the class Category.

public class Category {
} public class Company { Category category; public String toString() {
return category.toString(); }
}

Inheritance

 

public class Company {
}

public class SoftwareCompany extends Company {
}

3. Dependency detection area

Two levels of dependency are supported: between classes and packages. The package dependency live synchronization needs extra CPU resources.

4. Wire options area

This preference allows you to choose the dependency default router and anchor.

·        The router link could be manual or designed automatically using the Manhattan option