org.apache.felix.ipojo.dependency.interceptors

## Interface ServiceBindingInterceptor

All Superinterfaces:
  DependencyInterceptor

    public interface ServiceBindingInterceptor
    extends DependencyInterceptor

A service to modify / monitor the service bindings. This service is notified every time the dependency is weaving a new service bindings on un-weaves an existing one. Several binding interceptors can be plugged to the same service dependency. In this case, a chain is created where all interceptor are called in a sequence. A binding interceptor cannot modify the existing bindings. Obviously an interceptor can be plugged to several dependencies.

Since:
  1.11.0

### Field Summary

### Fields inherited from interface org.apache.felix.ipojo.dependency.interceptors.DependencyInterceptor

`TARGET_PROPERTY`

### Method Summary

All Methods Instance Methods Abstract Methods
`<S> S` `getService(DependencyModel dependency, org.osgi.framework.ServiceReference<S> reference, S service)` Notification method when a dependency is weaving a new service binding.
`<S> void` `ungetService(DependencyModel dependency, org.osgi.framework.ServiceReference<S> reference)` Notification method when a dependency is un-weaving a service binding.

### Methods inherited from interface org.apache.felix.ipojo.dependency.interceptors.DependencyInterceptor

`close, open`

### Method Detail

#### getService

    <S> S getService(DependencyModel dependency,
                     org.osgi.framework.ServiceReference<S> reference,
                     S service)

Notification method when a dependency is weaving a new service binding. The interceptor can modify the service object. It must never return a `null` object, but the receive service object if it does not want to do anything with the service object. When the interceptor modifies the service object, the returned object must be compatible with the dependency specification. The received service object may already have been wrapped by binding interceptors called before the current one.

Type Parameters:
  `S` - the service specification
Parameters:
  `dependency` - the dependency
  `reference` - the service reference bound
  `service` - the service object
Returns:
  the service object to be injected within the component. Must never be `null`.

#### ungetService

    <S> void ungetService(DependencyModel dependency,
                          org.osgi.framework.ServiceReference<S> reference)

Notification method when a dependency is un-weaving a service binding. The interceptor must released all objects related to this service binding.

Type Parameters:
  `S` - the service specification
Parameters:
  `dependency` - the dependency
  `reference` - the unbound service reference