Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 1 | package org.apache.felix.dm.lambda; |
| 2 | |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 3 | import org.apache.felix.dm.lambda.callbacks.CbRefServiceRefService; |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 4 | import org.apache.felix.dm.lambda.callbacks.CbRefServiceRefServiceComponent; |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 5 | import org.apache.felix.dm.lambda.callbacks.CbService; |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 6 | import org.apache.felix.dm.lambda.callbacks.CbServiceComponent; |
| 7 | import org.apache.felix.dm.lambda.callbacks.CbServiceComponentRef; |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 8 | import org.apache.felix.dm.lambda.callbacks.CbServiceDict; |
| 9 | import org.apache.felix.dm.lambda.callbacks.CbServiceMap; |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 10 | import org.apache.felix.dm.lambda.callbacks.CbServiceRef; |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 11 | import org.apache.felix.dm.lambda.callbacks.CbServiceService; |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 12 | import org.apache.felix.dm.lambda.callbacks.CbServiceServiceComponent; |
| 13 | import org.apache.felix.dm.lambda.callbacks.InstanceCbRefServiceRefService; |
| 14 | import org.apache.felix.dm.lambda.callbacks.InstanceCbRefServiceRefServiceComponent; |
| 15 | import org.apache.felix.dm.lambda.callbacks.InstanceCbService; |
| 16 | import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceComponent; |
| 17 | import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceComponentRef; |
| 18 | import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceDict; |
| 19 | import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceMap; |
| 20 | import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceRef; |
| 21 | import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceService; |
| 22 | import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceServiceComponent; |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Builds a service dependency callback (required by default). |
| 26 | * |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 27 | * TODO: fix javadoc for method reference (do the same as in ConfigurationDependencyBuilder: use double quotes ... |
| 28 | * |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 29 | * A Service may be injected in a bind-method of a component or an object instance using this builder. |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 30 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 33 | * |
| 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 49 | * |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 50 | * <b> List of signatures supported using java 8 method references: </b> |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 51 | * |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 52 | * <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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 65 | * <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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 66 | * The withSvc(...)" declaration defines a method reference on the "ComponentImpl::bindLogService" method (using a lambda): |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 67 | * |
| 68 | * <pre> {@code |
| 69 | * public class Activator extends DependencyManagerActivator { |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 70 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 72 | * } |
| 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 79 | * public void init(BundleContext ctx, DependencyManager dm) throws Exception { |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 80 | * ComponentImpl impl = new ComponentImpl(); |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 81 | * component(comp -> comp.impl(impl).withSvc(LogService.class, log -> log.add(impl::bindLogService))); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 82 | * } |
| 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 89 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 91 | * } |
| 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 98 | * public void init(BundleContext ctx, DependencyManager dm) throws Exception { |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 99 | * ComponentImpl impl = new ComponentImpl(); |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 100 | * component(comp -> comp.impl(impl).withSvc(LogService.class, log -> log.callbackInstance(impl).add("bindLogService"))); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 101 | * } |
| 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 | */ |
| 109 | public interface ServiceCallbacksBuilder<S, B extends ServiceCallbacksBuilder<S, B>> { |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 110 | |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 111 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 112 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 122 | * |
| 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 134 | * }</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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 196 | * 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 202 | * @param callback the remove callback |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 203 | * @return this builder |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 204 | * @see #callbackInstance(Object) |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 205 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 206 | B swap(String callback); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 207 | |
| 208 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 209 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 211 | * |
| 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 216 | <T> B add(CbService<T, S> add); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 217 | |
| 218 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 219 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 221 | * |
| 222 | * @param <T> the type of the component instance class on which the callback is invoked. |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 223 | * @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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 233 | * @param remove the method reference invoked when a service is removed. |
| 234 | * @return this builder |
| 235 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 236 | <T> B remove(CbService<T, S> remove); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 237 | |
| 238 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 239 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 241 | * |
| 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 244 | * @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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 253 | * @param change the method reference invoked when a service is changed. |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 254 | * @return this builder |
| 255 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 256 | <T> B change(CbServiceMap<T, S> change); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 257 | |
| 258 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 259 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 261 | * |
| 262 | * @param <T> the type of the component instance class on which the callback is invoked. |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 263 | * @param remove the method reference invoked when a service is removed. |
| 264 | * @return this builder |
| 265 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 266 | <T> B remove(CbServiceMap<T, S> remove); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 267 | |
| 268 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 269 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 271 | * |
| 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 274 | * @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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 283 | * @param change the method reference invoked when a service is changed. |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 284 | * @return this builder |
| 285 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 286 | <T> B change(CbServiceDict<T, S> change); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 287 | |
| 288 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 289 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 291 | * |
| 292 | * @param <T> the type of the component instance class on which the callback is invoked. |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 293 | * @param remove the method reference invoked when a service is removed. |
| 294 | * @return this builder |
| 295 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 296 | <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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 366 | |
| 367 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 368 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 370 | * |
| 371 | * @param <T> the type of the component instance class on which the callback is invoked. |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 372 | * @param change the method reference invoked when a service is changed. |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 373 | * @return this builder |
| 374 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 375 | <T> B change(CbServiceComponentRef<T, S> change); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 376 | |
| 377 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 378 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 380 | * |
| 381 | * @param <T> the type of the component instance class on which the callback is invoked. |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 382 | * @param remove the method reference invoked when a service is removed. |
| 383 | * @return this builder |
| 384 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 385 | <T> B remove(CbServiceComponentRef<T, S> remove); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 386 | |
| 387 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 388 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 390 | * |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 391 | * @param add the method reference invoked when a service is added. |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 392 | * @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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 400 | * @param change the method reference invoked when a service is changed. |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 401 | * @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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 409 | * @param remove the method reference invoked when a service is removed. |
| 410 | * @return this builder |
| 411 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 412 | B remove(InstanceCbService<S> remove); |
| 413 | |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 414 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 415 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 417 | * |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 418 | * @param add the method reference invoked when a service is added. |
| 419 | * @return this builder |
| 420 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 421 | 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 467 | |
| 468 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 469 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 471 | * |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 472 | * @param add the method reference invoked when a service is added. |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 473 | * @return this builder |
| 474 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 475 | B add(InstanceCbServiceRef<S> add); |
| 476 | |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 477 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 478 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 480 | * |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 481 | * @param change the method reference invoked when a service is changed. |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 482 | * @return this builder |
| 483 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 484 | B change(InstanceCbServiceRef<S> change); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 485 | |
| 486 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 487 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 552 | * |
| 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 557 | <T> B swap(CbServiceService<T, S> swap); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 558 | |
| 559 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 560 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 562 | * |
| 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 567 | <T> B swap(CbServiceServiceComponent<T, S> swap); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 568 | |
| 569 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 570 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 572 | * 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 578 | <T> B swap(CbRefServiceRefService<T, S> swap); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 579 | |
| 580 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 581 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 583 | * 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 Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 589 | <T> B swap(CbRefServiceRefServiceComponent<T, S> swap); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 590 | |
| 591 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 592 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 594 | * |
| 595 | * @param swap the method reference invoked when the service is swapped. |
| 596 | * @return this builder |
| 597 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 598 | B swap(InstanceCbServiceService<S> swap); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 599 | |
| 600 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 601 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 603 | * |
| 604 | * @param swap the method reference invoked when the service is swapped. |
| 605 | * @return this builder |
| 606 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 607 | B swap(InstanceCbServiceServiceComponent<S> swap); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 608 | |
| 609 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 610 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 612 | * |
| 613 | * @param swap the method reference invoked when the service is swapped. |
| 614 | * @return this builder |
| 615 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 616 | B swap(InstanceCbRefServiceRefService<S> swap); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 617 | |
| 618 | /** |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 619 | * 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 Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 621 | * |
| 622 | * @param swap the method reference invoked when the service is swapped. |
| 623 | * @return this builder |
| 624 | */ |
Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 625 | B swap(InstanceCbRefServiceRefServiceComponent<S> swap); |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 626 | } |