SE450: Basics: Dependency [40/63] |
file:Person.java [source] [doc-public] [doc-private]
01
02
03
04
05
06
07
08
09
10
11
12
13
14
package basics.dependency; import java.util.Random; final class Person { final private String name; public Person(String name) { this.name = name; } public String toString() { return "Person(" + name + ")"; }; } class PersonFactory { private PersonFactory() {} static private Random random = new Random(); static public Person randomPerson() { return new Person(Integer.toString(random.nextInt())); } }
+---------------+ | <<static>> | <<creates>> +--------+ | PersonFactory |- - - - - - - - >| Person | +---------------+ +--------+
This dependency indicates that PersonFactory mentions Person, but holds no references to Person objects.
Typical reasons for a dependency: