Interface ServiceCallbacksBuilder<S,B extends ServiceCallbacksBuilder<S,B>>
- Type Parameters:
S- the service dependency typeB- the type of a sub interface that may extends this interface.
- All Known Subinterfaces:
ServiceAdapterBuilder<T>,ServiceAspectBuilder<T>,ServiceDependencyBuilder<S>
A Service may be injected in a bind-method of a component or an object instance using this builder. The builder supports reflection based callbacks (same as with the original DM API), as well as java8 method reference based callbacks.
List of signatures supported using reflection based callbacks (same as original DM API):
method(S service)
method(S service, Map<String, Object> serviceProperties)
method(S service, Dictionary<String, Object> serviceProperties)
method(ServiceReference<S> serviceRef, S service),
method(ServiceReference<S> serviceRef)
method(ServiceObjects<S> serviceObjects)
method(Component serviceComponent)
method(Component serviceComponent, ServiceReference<S> serviceRef)
method(Component serviceComponent, S service)
method(Component serviceComponent, ServiceReference<S> serviceRef, S service)
swapMethod(S oldService, S newService)
swapMethod(ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService)
swapMethod(ServiceReference<S> oldRef, ServiceReference<S> newRef)
swapMethod(ServiceObjects<S> oldServiceObjects, ServiceObjects<S> newServiceObjects)
swapMethod(Component component, S oldService, S newService)
swapMethod(Component component, ServiceReference<S> oldService, ServiceReference<S> newService)
swapMethod(Component component, ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService)
List of signatures supported using java 8 method references:
method(S service)
method(S service, ServiceReference<S> serviceRef),
method(S service, Map<String, Object> serviceProperties)
method(S service, Dictionary<String, Object> serviceProperties)
method(S service, Component serviceComponent)
method(S service, Component serviceComponent, ServiceReference<S> serviceRef)
method(ServiceReference<S> service)
method(ServiceObjects<S> service)
method(ServiceReference<S> service, Component serviceComponent)
swapMethod(S oldService, S newService)
swapMethod(ServiceReference<> oldRef, ServiceReference<S> newRef)
swapMethod(S oldService, S newService, Component component))
swapMethod(ServiceReference<> oldRef, ServiceReference<S> newRef, Component component)
swapMethod(ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService)
swapMethod(ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService, Component component)
Here is an example of a Component that defines a dependency of a LogService which is injected in the "setLog" method using a ServiceCallbacksBuilder: The withSvc(...)" declaration defines a method reference on the "Pojo::setLog" method (using a lambda):
public class Activator extends DependencyManagerActivator {
public void init(BundleContext ctx, DependencyManager dm) throws Exception {
component(comp -> comp.impl(Pojo.class).withSvc(LogService.class, log -> log.add(Pojo::setLog)));
}
}
Same example, but we inject the dependency to an object instance that we already have in hand:
public class Activator extends DependencyManagerActivator {
public void init(BundleContext ctx, DependencyManager dm) throws Exception {
Pojo impl = new Pojo();
component(comp -> comp.impl(impl).withSvc(LogService.class, log -> log.add(impl::setLog)));
}
}
Here, we inject a service using method reflection (as it is the case in original DM api):
public class Activator extends DependencyManagerActivator {
public void init(BundleContext ctx, DependencyManager dm) throws Exception {
component(comp -> comp.impl(Pojo::class).withSvc(LogService.class, log -> log.add("setLog")));
}
}- Author:
- Felix Project Team
-
Method Summary
Modifier and TypeMethodDescriptionSets acallbackmethod to invoke when a service is added.<T> BSets acomponent callback(ServiceReference ref)method reference.<T> Badd(CbRefComponent<T, S> add) Sets acomponent callback(ServiceReference ref, Component comp)method reference.<T> BSets acomponent callback(Service)method reference.<T> Badd(CbServiceComponent<T, S> add) Sets acomponent callback(Service, Component)method reference.<T> Badd(CbServiceComponentRef<T, S> add) Sets acomponent callback(Service, Component, ServiceReference ref)method reference.<T> Badd(CbServiceDict<T, S> add) Sets acomponent callback(Service, Dictionary<String, Object>)method reference.<T> Badd(CbServiceMap<T, S> add) Sets acomponent callback(Service, Map<String, Object>)method reference.<T> Badd(CbServiceObjects<T, S> add) Sets acomponent callback(ServiceObjects ref)method reference.<T> Badd(CbServiceRef<T, S> add) Sets acomponent callback(Service, ServiceReference)method reference.add(InstanceCbRef<S> add) Sets anObject instance callback(ServiceReference)method reference.add(InstanceCbRefComponent<S> add) Sets anObject instance callback(ServiceReference, Component)method reference.add(InstanceCbService<S> add) Sets anObject instance callback(Service)method reference.add(InstanceCbServiceComponent<S> add) Sets anObject instance callback(Service, Component)method reference.Sets anObject instance callback(Service, Component, ServiceReference)method reference.add(InstanceCbServiceDict<S> add) Sets anObject instance callback(Service svc, Dictionary<String, Object>method reference.add(InstanceCbServiceMap<S> add) Sets anObject instance callback(Service, Map<String, Object>)method reference.add(InstanceCbServiceObjects<S> add) Sets anObject instance callback(ServiceObjects)method reference.add(InstanceCbServiceRef<S> add) Sets anObject instance callback(Service, ServiceReference)method reference.callbackInstance(Object callbackInstance) Sets the callback instance used for reflection based callbacks.Sets acallbackmethods to invoke when a service is changed.<T> BSets acomponent callback(ServiceReference)method reference.<T> Bchange(CbRefComponent<T, S> change) Sets acomponent callback(ServiceReference, Component comp)method reference.<T> BSets acomponent callback(Service)method reference.<T> Bchange(CbServiceComponent<T, S> change) Sets acomponent callback(Service, Component)method reference.<T> Bchange(CbServiceComponentRef<T, S> change) Sets acomponent callback(Service, Component, ServiceReference)method reference.<T> Bchange(CbServiceDict<T, S> change) Sets acomponent callback(Service, Dictionary<String, Object>)method reference.<T> Bchange(CbServiceMap<T, S> change) Sets acomponent callback(Service, Map<String, Object>)method reference.<T> Bchange(CbServiceObjects<T, S> change) Sets acomponent callback(ServiceObjects)method reference.<T> Bchange(CbServiceRef<T, S> change) Sets acomponent callback(Service, ServiceReference)method reference.change(InstanceCbRef<S> change) Sets anObject instance callback(ServiceReference)method reference.change(InstanceCbRefComponent<S> change) Sets anObject instance callback(ServiceReference, Component)method reference.change(InstanceCbService<S> change) Sets anObject instance callback(Service)method reference.change(InstanceCbServiceComponent<S> change) Sets anObject instance callback(Service, Component)method reference.change(InstanceCbServiceComponentRef<S> change) Sets anObject instance callback(Service, Component, ServiceReference)method reference.change(InstanceCbServiceDict<S> change) Sets anObject instance callback(Service, Dictionary<String, Object>)method reference.change(InstanceCbServiceMap<S> change) Sets anObject instance callback(Service, Map<String, Object>)method reference.change(InstanceCbServiceObjects<S> change) Sets anObject instance callback(ServiceObjects)method reference.change(InstanceCbServiceRef<S> change) Sets anObject instance callback(Service, ServiceReference)method reference.dereference(boolean obtainServiceBeforeInjection) Configures whether or not this dependency should internally obtain the service object for all tracked service references.Sets acallbackmethod to invoke when a service is removed.<T> BSets acomponent callback(ServiceReference)method reference.<T> Bremove(CbRefComponent<T, S> remove) Sets acomponent callback(ServiceReference, Component comp)method reference.<T> BSets acomponent callback(Service)method reference.<T> Bremove(CbServiceComponent<T, S> remove) Sets acomponent callback(Service, Component)method reference.<T> Bremove(CbServiceComponentRef<T, S> remove) Sets acomponent callback(Service, Component, ServiceReference)method reference.<T> Bremove(CbServiceDict<T, S> remove) Sets acomponent callback(Service, Dictionary<String, Object>)method reference.<T> Bremove(CbServiceMap<T, S> remove) Sets acomponent callback(Service, Map<String, Object></code>)method reference.<T> Bremove(CbServiceObjects<T, S> remove) Sets acomponent callback(ServiceObjects)method reference.<T> Bremove(CbServiceRef<T, S> remove) Sets acomponent callback(Service, ServiceReference)method reference.remove(InstanceCbRef<S> remove) Sets anObject instance callback(ServiceReference)method reference.remove(InstanceCbRefComponent<S> remove) Sets anObject instance callback(ServiceReference, Component)method reference.remove(InstanceCbService<S> remove) Sets anObject instance callback(Service)method reference.remove(InstanceCbServiceComponent<S> remove) Sets anObject instance callback(Service, Component)method reference.remove(InstanceCbServiceComponentRef<S> remove) Sets anObject instance callback(Service, Component, ServiceReference)method reference.remove(InstanceCbServiceDict<S> remove) Sets anObject instance callback(Service, Dictionary<String, Object>)method reference.remove(InstanceCbServiceMap<S> remove) Sets anObject instance callback(Service, Map<String, Object>)method reference.remove(InstanceCbServiceObjects<S> remove) Sets anObject instance callback(ServiceObjects)method reference.remove(InstanceCbServiceRef<S> remove) Sets anObject instance callback(Service, ServiceReference)method reference.Sets acallbackmethod to invoke when a service is swapped.<T> BSets a swapcomponent callback(Service, Service)method reference.<T> Bswap(CbRefRefComponent<T, S> swap) Sets a swapcomponent callback(ServiceRefere, ServiceReference, Component)method reference.<T> Bswap(CbRefServiceRefService<T, S> swap) Sets a swapcomponent callback(ServiceReference, Service, ServiceReference, Service)method reference.<T> Bswap(CbRefServiceRefServiceComponent<T, S> swap) Sets a swapcomponent callback(ServiceReference, Service, ServiceReference, Service, Componentmethod reference.<T> Bswap(CbServiceObjectsServiceObjects<T, S> swap) Sets a swapcomponent callback(ServiceObjects, ServiceObjects)method reference.<T> Bswap(CbServiceService<T, S> swap) Sets a swapcomponent callback(Service, Service)method reference.<T> Bswap(CbServiceServiceComponent<T, S> swap) Sets a swapcomponent callback(Service, Service, Component)method reference.swap(InstanceCbRefRef<S> swap) Sets a swapinstance callback(ServiceReference, ServiceReference)method reference.swap(InstanceCbRefRefComponent<S> swap) Sets a swapinstance callback(ServiceReference, ServiceReference, Component)method reference.swap(InstanceCbRefServiceRefService<S> swap) Sets a swapinstance callback(ServiceReference, Service, ServiceReference, Service)method reference.Sets a swapinstance callback(ServiceReference, Service, ServiceReference, Service, Component)method reference.Sets a swapinstance callback(ServiceObjects, ServiceObjects)method reference.swap(InstanceCbServiceService<S> swap) Sets a swapinstance callback(Service, Service)method reference.Sets a swapinstance callback(Service, Service, Component)method reference.
-
Method Details
-
callbackInstance
Sets the callback instance used for reflection based callbacks.- Parameters:
callbackInstance- the object on which reflection based callbacks are invoked on.- Returns:
- this builder
-
add
Sets acallbackmethod to invoke when a service is added. When a service matches the service filter, then the service is injected using the specified callback method. The callback is invoked on the component implementation, or on the callback instance, is specified using thecallbackInstance(Object)method. The following method signature are supported:method(S service) method(S service, Map<String, Object> serviceProperties) method(S service, Dictionary<String, Object> serviceProperties) method(ServiceReference<S> serviceRef, S service), method(ServiceReference<S> serviceRef) method(Component serviceComponent) method(Component serviceComponent, ServiceReference<S> serviceRef) method(Component serviceComponent, S service) method(Component serviceComponent, ServiceReference<S> serviceRef, S service)- Parameters:
callback- the add callback- Returns:
- this builder
- See Also:
-
change
Sets acallbackmethods to invoke when a service is changed. When a changed service matches the service filter, then the service is injected using the specified callback method. The callback is invoked on the component implementation, or on the callback instance, is specified using thecallbackInstance(Object)method. The following method signature are supported:method(S service) method(S service, Map<String, Object> serviceProperties) method(S service, Dictionary<String, Object> serviceProperties) method(ServiceReference<S> serviceRef, S service), method(ServiceReference<S> serviceRef) method(Component serviceComponent) method(Component serviceComponent, ServiceReference<S> serviceRef) method(Component serviceComponent, S service) method(Component serviceComponent, ServiceReference<S> serviceRef, S service)- Parameters:
callback- the change callback- Returns:
- this builder
- See Also:
-
remove
Sets acallbackmethod to invoke when a service is removed. When a removed service matches the service filter, then the specified callback in invoked with the removed service. The callback is invoked on the component implementation, or on the callback instance, is specified using thecallbackInstance(Object)method. The following method signature are supported:method(S service) method(S service, Map<String, Object> serviceProperties) method(S service, Dictionary<String, Object> serviceProperties) method(ServiceReference<S> serviceRef, S service), method(ServiceReference<S> serviceRef) method(Component serviceComponent) method(Component serviceComponent, ServiceReference<S> serviceRef) method(Component serviceComponent, S service) method(Component serviceComponent, ServiceReference<S> serviceRef, S service)- Parameters:
callback- the remove callback- Returns:
- this builder
- See Also:
-
swap
Sets acallbackmethod to invoke when a service is swapped. The callback is invoked on the component implementation, or on the callback instance, is specified using thecallbackInstance(Object)method. The following method signature are supported:swapMethod(S oldService, S newService) swapMethod(ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService) swapMethod(Component component, S oldService, S newService) swapMethod(Component component, ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService)- Parameters:
callback- the remove callback- Returns:
- this builder
- See Also:
-
add
Sets acomponent callback(Service)method reference. The callback is invoked when a service is added. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets acomponent callback(Service)method reference. The callback is invoked when a service is changed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets acomponent callback(Service)method reference. The callback is invoked when a service is removed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets acomponent callback(Service, Map<String, Object>)method reference. The callback is invoked when a service is added. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets acomponent callback(Service, Map<String, Object>)method reference. The callback is invoked when a service is changed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets acomponent callback(Service, Map<String, Object></code>)method reference. The callback is invoked when a service is removed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets acomponent callback(Service, Dictionary<String, Object>)method reference. The callback is invoked when a service is added. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets acomponent callback(Service, Dictionary<String, Object>)method reference. The callback is invoked when a service is changed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets acomponent callback(Service, Dictionary<String, Object>)method reference. The callback is invoked when a service is removed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets acomponent callback(Service, ServiceReference)method reference. The callback is invoked when a service is added. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets acomponent callback(Service, ServiceReference)method reference. The callback is invoked when a service is changed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets acomponent callback(Service, ServiceReference)method reference. The callback is invoked when a service is removed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets acomponent callback(Service, Component)method reference. The callback is invoked when a service is added. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets acomponent callback(Service, Component)method reference. The callback is invoked when a service is changed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets acomponent callback(Service, Component)method reference. The callback is invoked when a service is removed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets acomponent callback(Service, Component, ServiceReference ref)method reference. The callback is invoked when a service is added. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets acomponent callback(Service, Component, ServiceReference)method reference. The callback is invoked when a service is changed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets acomponent callback(Service, Component, ServiceReference)method reference. The callback is invoked when a service is removed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets acomponent callback(ServiceReference ref)method reference. The callback is invoked when a service is added. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets acomponent callback(ServiceReference)method reference. The callback is invoked when a service is changed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets acomponent callback(ServiceReference)method reference. The callback is invoked when a service is removed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets acomponent callback(ServiceObjects ref)method reference. The callback is invoked when a service is added. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets acomponent callback(ServiceObjects)method reference. The callback is invoked when a service is changed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets acomponent callback(ServiceObjects)method reference. The callback is invoked when a service is removed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets acomponent callback(ServiceReference ref, Component comp)method reference. The callback is invoked when a service is added. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets acomponent callback(ServiceReference, Component comp)method reference. The callback is invoked when a service is changed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets acomponent callback(ServiceReference, Component comp)method reference. The callback is invoked when a service is removed. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets anObject instance callback(Service)method reference. The callback is invoked when a service is added. The method reference must point to a method from an Object instance.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets anObject instance callback(Service)method reference. The callback is invoked when a service is changed. The method reference must point to method from an Object instance.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets anObject instance callback(Service)method reference. The callback is invoked when a service is removed. The method reference must point to method from an Object instance.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets anObject instance callback(Service, Map<String, Object>)method reference. The callback is invoked when a service is added. The method reference must point to a method from an Object instance.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets anObject instance callback(Service, Map<String, Object>)method reference. The callback is invoked when a service is changed. The method reference must point to method from an Object instance.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets anObject instance callback(Service, Map<String, Object>)method reference. The callback is invoked when a service is removed. The method reference must point to method from an Object instance.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets anObject instance callback(Service svc, Dictionary<String, Object>method reference. The callback is invoked when a service is added. The method reference must point to a method from an Object instance.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets anObject instance callback(Service, Dictionary<String, Object>)method reference. The callback is invoked when a service is changed. The method reference must point to method from an Object instance.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets anObject instance callback(Service, Dictionary<String, Object>)method reference. The callback is invoked when a service is removed. The method reference must point to method from an Object instance.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets anObject instance callback(Service, ServiceReference)method reference. The callback is invoked when a service is added. The method reference must point to a method from an Object instance.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets anObject instance callback(Service, ServiceReference)method reference. The callback is invoked when a service is changed. The method reference must point to method from an Object instance.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets anObject instance callback(Service, ServiceReference)method reference. The callback is invoked when a service is removed. The method reference must point to method from an Object instance.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets anObject instance callback(ServiceReference)method reference. The callback is invoked when a service is added. The method reference must point to a method from an Object instance.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets anObject instance callback(ServiceReference)method reference. The callback is invoked when a service is changed. The method reference must point to method from an Object instance.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets anObject instance callback(ServiceReference)method reference. The callback is invoked when a service is removed. The method reference must point to method from an Object instance.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets anObject instance callback(ServiceObjects)method reference. The callback is invoked when a service is added. The method reference must point to a method from an Object instance.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets anObject instance callback(ServiceObjects)method reference. The callback is invoked when a service is changed. The method reference must point to method from an Object instance.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets anObject instance callback(ServiceObjects)method reference. The callback is invoked when a service is removed. The method reference must point to method from an Object instance.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets anObject instance callback(Service, Component)method reference. The callback is when a service is added. The method reference must point to a method from an Object instance.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets anObject instance callback(Service, Component)method reference. The callback is when a service is changed. The method reference must point to method from an Object instance.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets anObject instance callback(Service, Component)method reference. The callback is invoked when a service is removed. The method reference must point to method from an Object instance.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets anObject instance callback(Service, Component, ServiceReference)method reference. The callback is invoked when a service is added. The method reference must point to a method from an Object instance.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets anObject instance callback(Service, Component, ServiceReference)method reference. The callback is invoked when a service is changed. The method reference must point to method from an Object instance.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets anObject instance callback(Service, Component, ServiceReference)method reference. The callback is invoked when a service is removed. The method reference must point to method from an Object instance.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
add
Sets anObject instance callback(ServiceReference, Component)method reference. The callback is invoked when a service is added. The method reference must point to a method from an Object instance.- Parameters:
add- the method reference invoked when a service is added.- Returns:
- this builder
-
change
Sets anObject instance callback(ServiceReference, Component)method reference. The callback is invoked when a service is changed. The method reference must point to method from an Object instance.- Parameters:
change- the method reference invoked when a service is changed.- Returns:
- this builder
-
remove
Sets anObject instance callback(ServiceReference, Component)method reference. The callback is invoked when a service is removed. The method reference must point to method from an Object instance.- Parameters:
remove- the method reference invoked when a service is removed.- Returns:
- this builder
-
swap
Sets a swapcomponent callback(Service, Service)method reference. The callback is invoked when a service is swapped. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapcomponent callback(Service, Service)method reference. The callback is invoked when a service is swapped. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapcomponent callback(ServiceObjects, ServiceObjects)method reference. The callback is invoked when a service is swapped. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapcomponent callback(Service, Service, Component)method reference. The callback is invoked when a service is swapped. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapcomponent callback(ServiceRefere, ServiceReference, Component)method reference. The callback is invoked when a service is swapped. The method reference must point to a Component implementation class method.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapcomponent callback(ServiceReference, Service, ServiceReference, Service)method reference. The callback is invoked when a service is swapped. The method reference must point to a Component implementation class method. the new service.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapcomponent callback(ServiceReference, Service, ServiceReference, Service, Componentmethod reference. The callback is invoked when a service is swapped. The method reference must point to a Component implementation class method. the new service.- Type Parameters:
T- the type of the component implementation class on which the callback is invoked.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapinstance callback(Service, Service)method reference. The callback is invoked when a service is swapped. The method reference must point to a method from an Object instance.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapinstance callback(ServiceReference, ServiceReference)method reference. The callback is invoked when a service is swapped. The method reference must point to a method from an Object instance.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapinstance callback(ServiceObjects, ServiceObjects)method reference. The callback is invoked when a service is swapped. The method reference must point to a method from an Object instance.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapinstance callback(ServiceReference, ServiceReference, Component)method reference. The callback is invoked when a service is swapped. The method reference must point to a method from an Object instance.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapinstance callback(Service, Service, Component)method reference. The callback is invoked when a service is swapped. The method reference must point to a method from an Object instance.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapinstance callback(ServiceReference, Service, ServiceReference, Service)method reference. The callback is invoked when a service is swapped. The method reference must point to a method from an Object instance.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
swap
Sets a swapinstance callback(ServiceReference, Service, ServiceReference, Service, Component)method reference. The callback is invoked when a service is swapped. The method reference must point to a method from an Object instance.- Parameters:
swap- the method reference invoked when the service is swapped.- Returns:
- this builder
-
dereference
Configures whether or not this dependency should internally obtain the service object for all tracked service references. By default, if you use a java method reference as dependency callbacks, then DM lambda auto-detects if your method takes as argument a ServiceReference. And in this case, the service reference is not internally dereferenced by DM (using BundleContext.getServiceReference() method). But if you are using a reflection based callback method name, then by default DM always internally dereference the service. In this case you can invoke thedereference(false)method in case you don't want DM to internally dereference the service. You will use this method typically when you are using a method name as the callback and when for example you want to dereference yourself the service using the ServiceObjects OSGi API.
-