Interface ServiceCallbacksBuilder<S,B extends ServiceCallbacksBuilder<S,B>>

Type Parameters:
S - the service dependency type
B - the type of a sub interface that may extends this interface.
All Known Subinterfaces:
ServiceAdapterBuilder<T>, ServiceAspectBuilder<T>, ServiceDependencyBuilder<S>

@ProviderType public interface ServiceCallbacksBuilder<S,B extends ServiceCallbacksBuilder<S,B>>
Builds a service dependency callback.

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 Details

    • callbackInstance

      B callbackInstance(Object 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

      B add(String callback)
      Sets a callback method 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 the callbackInstance(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

      B change(String callback)
      Sets a callback methods 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 the callbackInstance(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

      B remove(String callback)
      Sets a callback method 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 the callbackInstance(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

      B swap(String callback)
      Sets a callback method to invoke when a service is swapped. The callback is invoked on the component implementation, or on the callback instance, is specified using the callbackInstance(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

      <T> B add(CbService<T,S> add)
      Sets a component 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

      <T> B change(CbService<T,S> change)
      Sets a component 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

      <T> B remove(CbService<T,S> remove)
      Sets a component 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

      <T> B add(CbServiceMap<T,S> add)
      Sets a component 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

      <T> B change(CbServiceMap<T,S> change)
      Sets a component 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

      <T> B remove(CbServiceMap<T,S> remove)
      Sets a component 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

      <T> B add(CbServiceDict<T,S> add)
      Sets a component 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

      <T> B change(CbServiceDict<T,S> change)
      Sets a component 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

      <T> B remove(CbServiceDict<T,S> remove)
      Sets a component 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

      <T> B add(CbServiceRef<T,S> add)
      Sets a component 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

      <T> B change(CbServiceRef<T,S> change)
      Sets a component 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

      <T> B remove(CbServiceRef<T,S> remove)
      Sets a component 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

      <T> B add(CbServiceComponent<T,S> add)
      Sets a component 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

      <T> B change(CbServiceComponent<T,S> change)
      Sets a component 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

      <T> B remove(CbServiceComponent<T,S> remove)
      Sets a component 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

      <T> B add(CbServiceComponentRef<T,S> add)
      Sets a component 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

      <T> B change(CbServiceComponentRef<T,S> change)
      Sets a component 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

      <T> B remove(CbServiceComponentRef<T,S> remove)
      Sets a component 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

      <T> B add(CbRef<T,S> add)
      Sets a component 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

      <T> B change(CbRef<T,S> change)
      Sets a component 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

      <T> B remove(CbRef<T,S> remove)
      Sets a component 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

      <T> B add(CbServiceObjects<T,S> add)
      Sets a component 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

      <T> B change(CbServiceObjects<T,S> change)
      Sets a component 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

      <T> B remove(CbServiceObjects<T,S> remove)
      Sets a component 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

      <T> B add(CbRefComponent<T,S> add)
      Sets a component 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

      <T> B change(CbRefComponent<T,S> change)
      Sets a component 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

      <T> B remove(CbRefComponent<T,S> remove)
      Sets a component 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

      B add(InstanceCbService<S> add)
      Sets an Object 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

      B change(InstanceCbService<S> change)
      Sets an Object 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

      B remove(InstanceCbService<S> remove)
      Sets an Object 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 an Object 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

      B change(InstanceCbServiceMap<S> change)
      Sets an Object 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

      B remove(InstanceCbServiceMap<S> remove)
      Sets an Object 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 an Object 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

      B change(InstanceCbServiceDict<S> change)
      Sets an Object 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

      B remove(InstanceCbServiceDict<S> remove)
      Sets an Object 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 an Object 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

      B change(InstanceCbServiceRef<S> change)
      Sets an Object 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

      B remove(InstanceCbServiceRef<S> remove)
      Sets an Object 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

      B add(InstanceCbRef<S> add)
      Sets an Object 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

      B change(InstanceCbRef<S> change)
      Sets an Object 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

      B remove(InstanceCbRef<S> remove)
      Sets an Object 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 an Object 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

      B change(InstanceCbServiceObjects<S> change)
      Sets an Object 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

      B remove(InstanceCbServiceObjects<S> remove)
      Sets an Object 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 an Object 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

      B change(InstanceCbServiceComponent<S> change)
      Sets an Object 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

      B remove(InstanceCbServiceComponent<S> remove)
      Sets an Object 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 an Object 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 an Object 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 an Object 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 an Object 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

      B change(InstanceCbRefComponent<S> change)
      Sets an Object 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

      B remove(InstanceCbRefComponent<S> remove)
      Sets an Object 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

      <T> B swap(CbServiceService<T,S> swap)
      Sets a swap component 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

      <T> B swap(CbRefRef<T,S> swap)
      Sets a swap component 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

      <T> B swap(CbServiceObjectsServiceObjects<T,S> swap)
      Sets a swap component 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

      <T> B swap(CbServiceServiceComponent<T,S> swap)
      Sets a swap component 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

      <T> B swap(CbRefRefComponent<T,S> swap)
      Sets a swap component 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

      <T> B swap(CbRefServiceRefService<T,S> swap)
      Sets a swap component 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

      <T> B swap(CbRefServiceRefServiceComponent<T,S> swap)
      Sets a swap component callback(ServiceReference, Service, ServiceReference, Service, Component 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 swap instance 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

      B swap(InstanceCbRefRef<S> swap)
      Sets a swap instance 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 swap instance 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 swap instance 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 swap instance 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 swap instance 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 swap instance 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

      B dereference(boolean obtainServiceBeforeInjection)
      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 the dereference(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.