blob: 53723c2caf04f09561917c4bc8ac2aaa41d7bfa2 [file] [log] [blame]
Pierre De Ropfaca2892016-01-31 23:27:05 +00001package org.apache.felix.dm.lambda;
2
Pierre De Ropfaca2892016-01-31 23:27:05 +00003import org.apache.felix.dm.lambda.callbacks.CbRefServiceRefService;
Pierre De Rop11527502016-02-18 21:07:16 +00004import org.apache.felix.dm.lambda.callbacks.CbRefServiceRefServiceComponent;
Pierre De Ropfaca2892016-01-31 23:27:05 +00005import org.apache.felix.dm.lambda.callbacks.CbService;
Pierre De Rop11527502016-02-18 21:07:16 +00006import org.apache.felix.dm.lambda.callbacks.CbServiceComponent;
7import org.apache.felix.dm.lambda.callbacks.CbServiceComponentRef;
Pierre De Ropfaca2892016-01-31 23:27:05 +00008import org.apache.felix.dm.lambda.callbacks.CbServiceDict;
9import org.apache.felix.dm.lambda.callbacks.CbServiceMap;
Pierre De Rop11527502016-02-18 21:07:16 +000010import org.apache.felix.dm.lambda.callbacks.CbServiceRef;
Pierre De Ropfaca2892016-01-31 23:27:05 +000011import org.apache.felix.dm.lambda.callbacks.CbServiceService;
Pierre De Rop11527502016-02-18 21:07:16 +000012import org.apache.felix.dm.lambda.callbacks.CbServiceServiceComponent;
13import org.apache.felix.dm.lambda.callbacks.InstanceCbRefServiceRefService;
14import org.apache.felix.dm.lambda.callbacks.InstanceCbRefServiceRefServiceComponent;
15import org.apache.felix.dm.lambda.callbacks.InstanceCbService;
16import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceComponent;
17import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceComponentRef;
18import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceDict;
19import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceMap;
20import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceRef;
21import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceService;
22import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceServiceComponent;
Pierre De Ropfaca2892016-01-31 23:27:05 +000023
24/**
25 * Builds a service dependency callback (required by default).
26 *
Pierre De Rop11527502016-02-18 21:07:16 +000027 * TODO: fix javadoc for method reference (do the same as in ConfigurationDependencyBuilder: use double quotes ...
28 *
Pierre De Ropfaca2892016-01-31 23:27:05 +000029 * A Service may be injected in a bind-method of a component or an object instance using this builder.
Pierre De Rop11527502016-02-18 21:07:16 +000030 * The builder supports reflection based callbacks (same as with the original DM API), as well as java8 method reference based callbacks.
31 *
32 * <p> <b> List of signatures supported using reflection based callbacks (same as original DM API): </b>
Pierre De Ropfaca2892016-01-31 23:27:05 +000033 *
34 * <pre> {@code
35 * method(S service)
36 * method(S service, Map<String, Object> serviceProperties)
37 * method(S service, Dictionary<String, Object> serviceProperties)
38 * method(ServiceReference<S> serviceRef, S service),
39 * method(ServiceReference<S> serviceRef)
40 * method(Component serviceComponent)
41 * method(Component serviceComponent, ServiceReference<S> serviceRef)
42 * method(Component serviceComponent, S service)
43 * method(Component serviceComponent, ServiceReference<S> serviceRef, S service)
44 * swapMethod(S oldService, S newService)
45 * swapMethod(ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService)
46 * swapMethod(Component component, S oldService, S newService)
47 * swapMethod(Component component, ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService)
48 * }</pre>
Pierre De Ropfaca2892016-01-31 23:27:05 +000049 *
Pierre De Rop11527502016-02-18 21:07:16 +000050 * <b> List of signatures supported using java 8 method references: </b>
Pierre De Ropfaca2892016-01-31 23:27:05 +000051 *
Pierre De Rop11527502016-02-18 21:07:16 +000052 * <pre> {@code
53 * method(S service)
54 * method(S service, ServiceReference<S> serviceRef),
55 * method(S service, Map<String, Object> serviceProperties)
56 * method(S service, Dictionary<String, Object> serviceProperties)
57 * method(S service, Component serviceComponent)
58 * method(S service, Component serviceComponent, ServiceReference<S> serviceRef)
59 * swapMethod(S oldService, S newService)
60 * swapMethod(S oldService, S newService, Component component))
61 * swapMethod(ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService)
62 * swapMethod(ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService, Component component)
63 * }</pre>
64 *
Pierre De Ropfaca2892016-01-31 23:27:05 +000065 * <p> Here is an example of a Component that defines a dependency of a LogService which is injected in the "bindLogService" method using a ServiceCallbacksBuilder:
Pierre De Rop11527502016-02-18 21:07:16 +000066 * The withSvc(...)" declaration defines a method reference on the "ComponentImpl::bindLogService" method (using a lambda):
Pierre De Ropfaca2892016-01-31 23:27:05 +000067 *
68 * <pre> {@code
69 * public class Activator extends DependencyManagerActivator {
Pierre De Rop11527502016-02-18 21:07:16 +000070 * public void init(BundleContext ctx, DependencyManager dm) throws Exception {
71 * component(comp -> comp.impl(ComponentImpl.class).withSvc(LogService.class, log -> log.add(ComponentImpl::bindLogService)));
Pierre De Ropfaca2892016-01-31 23:27:05 +000072 * }
73 * }}</pre>
74 *
75 * <p> Same example, but we inject the dependency in an object instance that we already have in hand:
76 *
77 * <pre> {@code
78 * public class Activator extends DependencyManagerActivator {
Pierre De Rop11527502016-02-18 21:07:16 +000079 * public void init(BundleContext ctx, DependencyManager dm) throws Exception {
Pierre De Ropfaca2892016-01-31 23:27:05 +000080 * ComponentImpl impl = new ComponentImpl();
Pierre De Rop11527502016-02-18 21:07:16 +000081 * component(comp -> comp.impl(impl).withSvc(LogService.class, log -> log.add(impl::bindLogService)));
Pierre De Ropfaca2892016-01-31 23:27:05 +000082 * }
83 * }}</pre>
84 *
85 * <p> Here, we inject a service using method reflection (as it is the case in original DM api):
86 *
87 * <pre> {@code
88 * public class Activator extends DependencyManagerActivator {
Pierre De Rop11527502016-02-18 21:07:16 +000089 * public void init(BundleContext ctx, DependencyManager dm) throws Exception {
90 * component(comp -> comp.impl(ComponentImpl::class).withSvc(LogService.class, log -> log.add("bindLogService")));
Pierre De Ropfaca2892016-01-31 23:27:05 +000091 * }
92 * }}</pre>
93 *
94 * <p> Same example, but we inject the dependency in an object instance that we already have in hand:
95 *
96 * <pre> {@code
97 * public class Activator extends DependencyManagerActivator {
Pierre De Rop11527502016-02-18 21:07:16 +000098 * public void init(BundleContext ctx, DependencyManager dm) throws Exception {
Pierre De Ropfaca2892016-01-31 23:27:05 +000099 * ComponentImpl impl = new ComponentImpl();
Pierre De Rop11527502016-02-18 21:07:16 +0000100 * component(comp -> comp.impl(impl).withSvc(LogService.class, log -> log.callbackInstance(impl).add("bindLogService")));
Pierre De Ropfaca2892016-01-31 23:27:05 +0000101 * }
102 * }}</pre>
103 *
104 * @param <S> the service dependency type
105 * @param <B> the type of a sub interface that may extends this interface.
106 *
107 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
108 */
109public interface ServiceCallbacksBuilder<S, B extends ServiceCallbacksBuilder<S, B>> {
Pierre De Rop11527502016-02-18 21:07:16 +0000110
Pierre De Ropfaca2892016-01-31 23:27:05 +0000111 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000112 * Sets the callback instance used for reflection based callbacks.
113 * @param callbackInstance the object on which reflection based callbacks are invoked on.
114 * @return this builder
115 */
116 B callbackInstance(Object callbackInstance);
117
118 /**
119 * Sets <code>callback</code> methods to invoke when a service is added. When a service matches the service
120 * filter, then the service is injected using the specified callback method. The callback is invoked on the component instances, or on the callback
121 * instance, is specified using the {@link #callbackInstance(Object)} method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000122 *
123 * The following method signature are supported:
124 * <pre>{@code
125 * method(S service)
126 * method(S service, Map<String, Object> serviceProperties)
127 * method(S service, Dictionary<String, Object> serviceProperties)
128 * method(ServiceReference<S> serviceRef, S service),
129 * method(ServiceReference<S> serviceRef)
130 * method(Component serviceComponent)
131 * method(Component serviceComponent, ServiceReference<S> serviceRef)
132 * method(Component serviceComponent, S service)
133 * method(Component serviceComponent, ServiceReference<S> serviceRef, S service)
Pierre De Rop11527502016-02-18 21:07:16 +0000134 * }</pre>
135 *
136 * @param callback the add callback
137 * @return this builder
138 * @see #callbackInstance(Object)
139 */
140 B add(String callback);
141
142 /**
143 * Sets <code>callback</code> methods to invoke when a service is changed. When a changed service matches the service
144 * filter, then the service is injected using the specified callback method. The callback is invoked on the component instances, or on the callback
145 * instance, is specified using the {@link #callbackInstance(Object)} method.
146 *
147 * The following method signature are supported:
148 * <pre>{@code
149 * method(S service)
150 * method(S service, Map<String, Object> serviceProperties)
151 * method(S service, Dictionary<String, Object> serviceProperties)
152 * method(ServiceReference<S> serviceRef, S service),
153 * method(ServiceReference<S> serviceRef)
154 * method(Component serviceComponent)
155 * method(Component serviceComponent, ServiceReference<S> serviceRef)
156 * method(Component serviceComponent, S service)
157 * method(Component serviceComponent, ServiceReference<S> serviceRef, S service)
158 * }</pre>
159 *
160 * @param callback the change callback
161 * @return this builder
162 * @see #callbackInstance(Object)
163 */
164 B change(String callback);
165
166 /**
167 * Sets <code>callback</code> methods to invoke when a service is removed. When a removed service matches the service
168 * filter, then the specified callback in invoked with the removed service. The callback is invoked on the component instances, or on the callback
169 * instance, is specified using the {@link #callbackInstance(Object)} method.
170 *
171 * The following method signature are supported:
172 * <pre>{@code
173 * method(S service)
174 * method(S service, Map<String, Object> serviceProperties)
175 * method(S service, Dictionary<String, Object> serviceProperties)
176 * method(ServiceReference<S> serviceRef, S service),
177 * method(ServiceReference<S> serviceRef)
178 * method(Component serviceComponent)
179 * method(Component serviceComponent, ServiceReference<S> serviceRef)
180 * method(Component serviceComponent, S service)
181 * method(Component serviceComponent, ServiceReference<S> serviceRef, S service)
182 * }</pre>
183 *
184 * @param callback the remove callback
185 * @return this builder
186 * @see #callbackInstance(Object)
187 */
188 B remove(String callback);
189
190 /**
191 * Sets <code>callback</code> methods to invoke when a service is swapped. The callback is invoked on the component instances, or on the callback
192 * instance, is specified using the {@link #callbackInstance(Object)} method.
193 *
194 * The following method signature are supported:
195 * <pre>{@code
Pierre De Ropfaca2892016-01-31 23:27:05 +0000196 * swapMethod(S oldService, S newService)
197 * swapMethod(ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService)
198 * swapMethod(Component component, S oldService, S newService)
199 * swapMethod(Component component, ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService)
200 * }</pre>
201 *
Pierre De Rop11527502016-02-18 21:07:16 +0000202 * @param callback the remove callback
Pierre De Ropfaca2892016-01-31 23:27:05 +0000203 * @return this builder
Pierre De Rop11527502016-02-18 21:07:16 +0000204 * @see #callbackInstance(Object)
Pierre De Ropfaca2892016-01-31 23:27:05 +0000205 */
Pierre De Rop11527502016-02-18 21:07:16 +0000206 B swap(String callback);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000207
208 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000209 * Sets a <code>component instance callback(Service)</code> callback. The callback is invoked when a service is added.
210 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000211 *
212 * @param <T> the type of the component instance class on which the callback is invoked.
213 * @param add the method reference invoked when a service is added.
214 * @return this builder
215 */
Pierre De Rop11527502016-02-18 21:07:16 +0000216 <T> B add(CbService<T, S> add);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000217
218 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000219 * Sets a <code>component instance callback(Service)</code> callback. The callback is invoked when a service is changed.
220 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000221 *
222 * @param <T> the type of the component instance class on which the callback is invoked.
Pierre De Rop11527502016-02-18 21:07:16 +0000223 * @param change the method reference invoked when a service is changed.
224 * @return this builder
225 */
226 <T> B change(CbService<T, S> change);
227
228 /**
229 * Sets a <code>component instance callback(Service)</code> callback. The callback is invoked when a service is removed.
230 * The method reference must point to a Component implementation class method.
231 *
232 * @param <T> the type of the component instance class on which the callback is invoked.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000233 * @param remove the method reference invoked when a service is removed.
234 * @return this builder
235 */
Pierre De Rop11527502016-02-18 21:07:16 +0000236 <T> B remove(CbService<T, S> remove);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000237
238 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000239 * Sets a {@code component instance callback(Service, Map<String, Object>)} callback. The callback is invoked when a service is added.
240 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000241 *
242 * @param <T> the type of the component instance class on which the callback is invoked.
243 * @param add the method reference invoked when a service is added.
Pierre De Rop11527502016-02-18 21:07:16 +0000244 * @return this builder
245 */
246 <T> B add(CbServiceMap<T, S> add);
247
248 /**
249 * Sets a {@code component instance callback(Service, Map<String, Object>)} callback. The callback is invoked when a service is changed.
250 * The method reference must point to a Component implementation class method.
251 *
252 * @param <T> the type of the component instance class on which the callback is invoked.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000253 * @param change the method reference invoked when a service is changed.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000254 * @return this builder
255 */
Pierre De Rop11527502016-02-18 21:07:16 +0000256 <T> B change(CbServiceMap<T, S> change);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000257
258 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000259 * Sets a {@code component instance callback(Service, Map<String, Object></code>)} callback. The callback is invoked when a service is removed.
260 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000261 *
262 * @param <T> the type of the component instance class on which the callback is invoked.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000263 * @param remove the method reference invoked when a service is removed.
264 * @return this builder
265 */
Pierre De Rop11527502016-02-18 21:07:16 +0000266 <T> B remove(CbServiceMap<T, S> remove);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000267
268 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000269 * Sets a {@code component instance callback(Service, Dictionary<String, Object>)} callback. The callback is invoked when a service is added.
270 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000271 *
272 * @param <T> the type of the component instance class on which the callback is invoked.
273 * @param add the method reference invoked when a service is added.
Pierre De Rop11527502016-02-18 21:07:16 +0000274 * @return this builder
275 */
276 <T> B add(CbServiceDict<T, S> add);
277
278 /**
279 * Sets a {@code component instance callback(Service, Dictionary<String, Object>)} callback. The callback is invoked when a service is changed.
280 * The method reference must point to a Component implementation class method.
281 *
282 * @param <T> the type of the component instance class on which the callback is invoked.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000283 * @param change the method reference invoked when a service is changed.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000284 * @return this builder
285 */
Pierre De Rop11527502016-02-18 21:07:16 +0000286 <T> B change(CbServiceDict<T, S> change);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000287
288 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000289 * Sets a {@code component instance callback(Service, Dictionary<String, Object>)} callback. The callback is invoked when a service is removed.
290 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000291 *
292 * @param <T> the type of the component instance class on which the callback is invoked.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000293 * @param remove the method reference invoked when a service is removed.
294 * @return this builder
295 */
Pierre De Rop11527502016-02-18 21:07:16 +0000296 <T> B remove(CbServiceDict<T, S> remove);
297
298 /**
299 * Sets a <code>component instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is added.
300 * The method reference must point to a Component implementation class method.
301 * @param <T> the type of the component instance class on which the callback is invoked.
302 * @param add the method reference invoked when a service is added.
303 * @return this builder
304 */
305 <T> B add(CbServiceRef<T, S> add);
306
307 /**
308 * Sets a <code>component instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is changed.
309 * The method reference must point to a Component implementation class method.
310 *
311 * @param <T> the type of the component instance class on which the callback is invoked.
312 * @param change the method reference invoked when a service is changed.
313 * @return this builder
314 */
315 <T> B change(CbServiceRef<T, S> change);
316
317 /**
318 * Sets a <code>component instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is removed.
319 * The method reference must point to a Component implementation class method.
320 *
321 * @param <T> the type of the component instance class on which the callback is invoked.
322 * @param remove the method reference invoked when a service is removed.
323 * @return this builder
324 */
325 <T> B remove(CbServiceRef<T, S> remove);
326
327 /**
328 * Sets a <code>component instance callback(Service, Component)</code> callback. The callback is invoked when a service is added.
329 * The method reference must point to a Component implementation class method.
330 *
331 * @param <T> the type of the component instance class on which the callback is invoked.
332 * @param add the method reference invoked when a service is added.
333 * @return this builder
334 */
335 <T> B add(CbServiceComponent<T, S> add);
336
337 /**
338 * Sets a <code>component instance callback(Service, Component)</code> callback. The callback is invoked when a service is changed.
339 * The method reference must point to a Component implementation class method.
340 *
341 * @param <T> the type of the component instance class on which the callback is invoked.
342 * @param change the method reference invoked when a service is changed.
343 * @return this builder
344 */
345 <T> B change(CbServiceComponent<T, S> change);
346
347 /**
348 * Sets a <code>component instance callback(Service, Component)</code> callback. The callback is invoked when a service is removed.
349 * The method reference must point to a Component implementation class method.
350 *
351 * @param <T> the type of the component instance class on which the callback is invoked.
352 * @param remove the method reference invoked when a service is removed.
353 * @return this builder
354 */
355 <T> B remove(CbServiceComponent<T, S> remove);
356
357 /**
358 * Sets a <code>component instance callback(Service, Component, ServiceReference ref)</code> callback. The callback is invoked when a service is added.
359 * The method reference must point to a Component implementation class method.
360 *
361 * @param <T> the type of the component instance class on which the callback is invoked.
362 * @param add the method reference invoked when a service is added.
363 * @return this builder
364 */
365 <T> B add(CbServiceComponentRef<T, S> add);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000366
367 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000368 * Sets a <code>component instance callback(Service, Component, ServiceReference)</code> callback. The callback is invoked when a service is changed.
369 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000370 *
371 * @param <T> the type of the component instance class on which the callback is invoked.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000372 * @param change the method reference invoked when a service is changed.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000373 * @return this builder
374 */
Pierre De Rop11527502016-02-18 21:07:16 +0000375 <T> B change(CbServiceComponentRef<T, S> change);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000376
377 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000378 * Sets a <code>component instance callback(Service, Component, ServiceReference)</code> callback. The callback is invoked when a service is removed.
379 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000380 *
381 * @param <T> the type of the component instance class on which the callback is invoked.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000382 * @param remove the method reference invoked when a service is removed.
383 * @return this builder
384 */
Pierre De Rop11527502016-02-18 21:07:16 +0000385 <T> B remove(CbServiceComponentRef<T, S> remove);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000386
387 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000388 * Sets an <code>object instance callback(Service)</code> callback. The callback is invoked when a service is added.
389 * The method reference must point to a method from an Object instance.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000390 *
Pierre De Ropfaca2892016-01-31 23:27:05 +0000391 * @param add the method reference invoked when a service is added.
Pierre De Rop11527502016-02-18 21:07:16 +0000392 * @return this builder
393 */
394 B add(InstanceCbService<S> add);
395
396 /**
397 * Sets an <code>object instance callback(Service)</code> callback. The callback is invoked when a service is changed.
398 * The method reference must point to method from an Object instance.
399 *
Pierre De Ropfaca2892016-01-31 23:27:05 +0000400 * @param change the method reference invoked when a service is changed.
Pierre De Rop11527502016-02-18 21:07:16 +0000401 * @return this builder
402 */
403 B change(InstanceCbService<S> change);
404
405 /**
406 * Sets an <code>object instance callback(Service)</code> callback. The callback is invoked when a service is removed.
407 * The method reference must point to method from an Object instance.
408 *
Pierre De Ropfaca2892016-01-31 23:27:05 +0000409 * @param remove the method reference invoked when a service is removed.
410 * @return this builder
411 */
Pierre De Rop11527502016-02-18 21:07:16 +0000412 B remove(InstanceCbService<S> remove);
413
Pierre De Ropfaca2892016-01-31 23:27:05 +0000414 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000415 * Sets an {@code object instance callback(Service, Map<String, Object>)} callback. The callback is invoked when a service is added.
416 * The method reference must point to a method from an Object instance.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000417 *
Pierre De Ropfaca2892016-01-31 23:27:05 +0000418 * @param add the method reference invoked when a service is added.
419 * @return this builder
420 */
Pierre De Rop11527502016-02-18 21:07:16 +0000421 B add(InstanceCbServiceMap<S> add);
422
423 /**
424 * Sets an {@code object instance callback(Service, Map<String, Object>)} callback. The callback is invoked when a service is changed.
425 * The method reference must point to method from an Object instance.
426 *
427 * @param change the method reference invoked when a service is changed.
428 * @return this builder
429 */
430 B change(InstanceCbServiceMap<S> change);
431
432 /**
433 * Sets an {@code object instance callback(Service, Map<String, Object>)} callback. The callback is invoked when a service is removed.
434 * The method reference must point to method from an Object instance.
435 *
436 * @param remove the method reference invoked when a service is removed.
437 * @return this builder
438 */
439 B remove(InstanceCbServiceMap<S> remove);
440
441 /**
442 * Sets an {@code object instance callback(Service svc, Dictionary<String, Object>} callback. The callback is invoked when a service is added.
443 * The method reference must point to a method from an Object instance.
444 *
445 * @param add the method reference invoked when a service is added.
446 * @return this builder
447 */
448 B add(InstanceCbServiceDict<S> add);
449
450 /**
451 * Sets an {@code object instance callback(Service, Dictionary<String, Object>)} callback. The callback is invoked when a service is changed.
452 * The method reference must point to method from an Object instance.
453 *
454 * @param change the method reference invoked when a service is changed.
455 * @return this builder
456 */
457 B change(InstanceCbServiceDict<S> change);
458
459 /**
460 * Sets an {@code object instance callback(Service, Dictionary<String, Object>)} callback. The callback is invoked when a service is removed.
461 * The method reference must point to method from an Object instance.
462 *
463 * @param remove the method reference invoked when a service is removed.
464 * @return this builder
465 */
466 B remove(InstanceCbServiceDict<S> remove);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000467
468 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000469 * Sets an <code>object instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is added.
470 * The method reference must point to a method from an Object instance.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000471 *
Pierre De Ropfaca2892016-01-31 23:27:05 +0000472 * @param add the method reference invoked when a service is added.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000473 * @return this builder
474 */
Pierre De Rop11527502016-02-18 21:07:16 +0000475 B add(InstanceCbServiceRef<S> add);
476
Pierre De Ropfaca2892016-01-31 23:27:05 +0000477 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000478 * Sets an <code>object instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is changed.
479 * The method reference must point to method from an Object instance.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000480 *
Pierre De Ropfaca2892016-01-31 23:27:05 +0000481 * @param change the method reference invoked when a service is changed.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000482 * @return this builder
483 */
Pierre De Rop11527502016-02-18 21:07:16 +0000484 B change(InstanceCbServiceRef<S> change);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000485
486 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000487 * Sets an <code>object instance callback(Service, ServiceReference)</code> callback. The callback is invoked when a service is removed.
488 * The method reference must point to method from an Object instance.
489 *
490 * @param remove the method reference invoked when a service is removed.
491 * @return this builder
492 */
493 B remove(InstanceCbServiceRef<S> remove);
494
495 /**
496 * Sets an <code>object instance callback(Service, Component)</code> callback invoked. The callback is when a service is added.
497 * The method reference must point to a method from an Object instance.
498 *
499 * @param add the method reference invoked when a service is added.
500 * @return this builder
501 */
502 B add(InstanceCbServiceComponent<S> add);
503
504 /**
505 * Sets an <code>object instance callback(Service, Component)</code> callback invoked. The callback is when a service is changed.
506 * The method reference must point to method from an Object instance.
507 *
508 * @param change the method reference invoked when a service is changed.
509 * @return this builder
510 */
511 B change(InstanceCbServiceComponent<S> change);
512
513 /**
514 * Sets an <code>object instance callback(Service, Component)</code> callback. The callback is invoked when a service is removed.
515 * The method reference must point to method from an Object instance.
516 *
517 * @param remove the method reference invoked when a service is removed.
518 * @return this builder
519 */
520 B remove(InstanceCbServiceComponent<S> remove);
521
522 /**
523 * Sets an <code>object instance callback(Service, Component, ServiceReference)</code> callback. The callback is invoked when a service is added.
524 * The method reference must point to a method from an Object instance.
525 *
526 * @param add the method reference invoked when a service is added.
527 * @return this builder
528 */
529 B add(InstanceCbServiceComponentRef<S> add);
530
531 /**
532 * Sets an <code>object instance callback(Service, Component, ServiceReference)</code> callback. The callback is invoked when a service is changed.
533 * The method reference must point to method from an Object instance.
534 *
535 * @param change the method reference invoked when a service is changed.
536 * @return this builder
537 */
538 B change(InstanceCbServiceComponentRef<S> change);
539
540 /**
541 * Sets an <code>object instance callback(Service, Component, ServiceReference)</code> callback. The callback is invoked when a service is removed.
542 * The method reference must point to method from an Object instance.
543 *
544 * @param remove the method reference invoked when a service is removed.
545 * @return this builder
546 */
547 B remove(InstanceCbServiceComponentRef<S> remove);
548
549 /**
550 * Sets a swap <code>component instance callback(Service, Service)</code> method reference. The callback is invoked when a service is swapped.
551 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000552 *
553 * @param <T> the type of the component instance class on which the callback is invoked.
554 * @param swap the method reference invoked when the service is swapped.
555 * @return this builder
556 */
Pierre De Rop11527502016-02-18 21:07:16 +0000557 <T> B swap(CbServiceService<T, S> swap);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000558
559 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000560 * Sets a wap <code>component instance callback(Service, Service, Component)</code> method reference. The callback is invoked when a service is swapped.
561 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000562 *
563 * @param <T> the type of the component instance class on which the callback is invoked.
564 * @param swap the method reference invoked when the service is swapped.
565 * @return this builder
566 */
Pierre De Rop11527502016-02-18 21:07:16 +0000567 <T> B swap(CbServiceServiceComponent<T, S> swap);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000568
569 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000570 * Sets a swap <code>component instance callback(ServiceReference, Service, ServiceReference, Service)</code> method reference. The callback is invoked when a service is swapped.
571 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000572 * the new service.
573 *
574 * @param <T> the type of the component instance class on which the callback is invoked.
575 * @param swap the method reference invoked when the service is swapped.
576 * @return this builder
577 */
Pierre De Rop11527502016-02-18 21:07:16 +0000578 <T> B swap(CbRefServiceRefService<T, S> swap);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000579
580 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000581 * Sets a swap <code>component instance callback(ServiceReference, Service, ServiceReference, Service, Component</code> method reference. The callback is invoked when a service is swapped.
582 * The method reference must point to a Component implementation class method.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000583 * the new service.
584 *
585 * @param <T> the type of the component instance class on which the callback is invoked.
586 * @param swap the method reference invoked when the service is swapped.
587 * @return this builder
588 */
Pierre De Rop11527502016-02-18 21:07:16 +0000589 <T> B swap(CbRefServiceRefServiceComponent<T, S> swap);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000590
591 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000592 * Sets a swap <code>instance callback(Service, Service)</code> method reference. The callback is invoked when a service is swapped.
593 * The method reference must point to a method from an Object instance.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000594 *
595 * @param swap the method reference invoked when the service is swapped.
596 * @return this builder
597 */
Pierre De Rop11527502016-02-18 21:07:16 +0000598 B swap(InstanceCbServiceService<S> swap);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000599
600 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000601 * Sets a swap <code>instance callback(Service, Service, Component)</code> method reference. The callback is invoked when a service is swapped.
602 * The method reference must point to a method from an Object instance.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000603 *
604 * @param swap the method reference invoked when the service is swapped.
605 * @return this builder
606 */
Pierre De Rop11527502016-02-18 21:07:16 +0000607 B swap(InstanceCbServiceServiceComponent<S> swap);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000608
609 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000610 * Sets a swap <code>instance callback(ServiceReference, Service, ServiceReference, Service)</code> method reference. The callback is invoked when a service is swapped.
611 * The method reference must point to a method from an Object instance.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000612 *
613 * @param swap the method reference invoked when the service is swapped.
614 * @return this builder
615 */
Pierre De Rop11527502016-02-18 21:07:16 +0000616 B swap(InstanceCbRefServiceRefService<S> swap);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000617
618 /**
Pierre De Rop11527502016-02-18 21:07:16 +0000619 * Sets a swap <code>instance callback(ServiceReference, Service, ServiceReference, Service, Component)</code> method reference. The callback is invoked when a service is swapped.
620 * The method reference must point to a method from an Object instance.
Pierre De Ropfaca2892016-01-31 23:27:05 +0000621 *
622 * @param swap the method reference invoked when the service is swapped.
623 * @return this builder
624 */
Pierre De Rop11527502016-02-18 21:07:16 +0000625 B swap(InstanceCbRefServiceRefServiceComponent<S> swap);
Pierre De Ropfaca2892016-01-31 23:27:05 +0000626}