@@ -47,30 +47,82 @@ private Dependency(Class<?> anInterface, @Type int type, @Injection int injectio
47
47
this .injection = injection ;
48
48
}
49
49
50
+ /**
51
+ * Declares an optional dependency.
52
+ *
53
+ * <p>Optional dependencies can be missing at runtime(being {@code null}) and dependents must be
54
+ * ready to handle that.
55
+ *
56
+ * @deprecated Optional dependencies are not safe to use in the context of Play's dynamic feature
57
+ * delivery. Use {@link #optionalProvider(Class) optional provider} instead.
58
+ */
59
+ @ Deprecated
50
60
public static Dependency optional (Class <?> anInterface ) {
51
61
return new Dependency (anInterface , Type .OPTIONAL , Injection .DIRECT );
52
62
}
53
63
64
+ /**
65
+ * Declares a deferred dependency.
66
+ *
67
+ * <p>Such dependencies are optional and may not be present by default. But they can become
68
+ * available if a dynamic module that contains them is installed.
69
+ */
54
70
public static Dependency deferred (Class <?> anInterface ) {
55
71
return new Dependency (anInterface , Type .OPTIONAL , Injection .DEFERRED );
56
72
}
57
73
74
+ /**
75
+ * Declares a required dependency.
76
+ *
77
+ * <p>Such dependencies must be present in order for the dependent component to function. Any
78
+ * component with a required dependency should also declare a Maven dependency on an SDK that
79
+ * provides it. Failing to do so will result in a {@link MissingDependencyException} to be thrown
80
+ * at runtime.
81
+ */
58
82
public static Dependency required (Class <?> anInterface ) {
59
83
return new Dependency (anInterface , Type .REQUIRED , Injection .DIRECT );
60
84
}
61
85
86
+ /**
87
+ * Declares a Set multi-binding dependency.
88
+ *
89
+ * <p>Such dependencies provide access to a {@code Set<Foo>} to dependent components. Note that
90
+ * the set is only filled with components that explicitly declare the intent to be a "set"
91
+ * dependency via {@link Component#intoSet(Object, Class)}.
92
+ */
62
93
public static Dependency setOf (Class <?> anInterface ) {
63
94
return new Dependency (anInterface , Type .SET , Injection .DIRECT );
64
95
}
65
96
97
+ /**
98
+ * Declares an optional dependency.
99
+ *
100
+ * <p>Optional dependencies can be missing at runtime(being {@code null}) and dependents must be
101
+ * ready to handle that.
102
+ */
66
103
public static Dependency optionalProvider (Class <?> anInterface ) {
67
104
return new Dependency (anInterface , Type .OPTIONAL , Injection .PROVIDER );
68
105
}
69
106
107
+ /**
108
+ * Declares a required dependency.
109
+ *
110
+ * <p>Such dependencies must be present in order for the dependent component to function. Any
111
+ * component with a required dependency should also declare a Maven dependency on an SDK that
112
+ * provides it. Failing to do so will result in a {@link MissingDependencyException} to be thrown
113
+ * at runtime.
114
+ */
70
115
public static Dependency requiredProvider (Class <?> anInterface ) {
71
116
return new Dependency (anInterface , Type .REQUIRED , Injection .PROVIDER );
72
117
}
73
118
119
+ /**
120
+ * Declares a Set multi-binding dependency.
121
+ *
122
+ * <p>Such dependencies provide access to a {@code Set<Foo>} to dependent components. Note that
123
+ * the set is only filled with components that explicitly declare the intent to be a "set"
124
+ * dependency via {@link Component#intoSet(Object, Class)}.
125
+ */
74
126
public static Dependency setOfProvider (Class <?> anInterface ) {
75
127
return new Dependency (anInterface , Type .SET , Injection .PROVIDER );
76
128
}
0 commit comments