@Retention(value=CLASS)
@Target(value=METHOD)
public @interface BundleDependency
In the following example, the "SCR" Component allows to track all bundles containing a specific "Service-Component" OSGi header, in order to load and manage all Declarative Service components specified in the SCR xml documents referenced by the header:
 
 @Component
 public class SCR {
     @BundleDependency(required = false,
                       removed = "unloadServiceComponents", 
                       filter = "(Service-Component=*)"
                       stateMask = Bundle.ACTIVE)
     void loadServiceComponents(Bundle b) {
         String descriptorPaths = (String) b.getHeaders().get("Service-Component");
         // load all service component specified in the XML descriptorPaths files ...
     }
     void unloadServiceComponents(Bundle b) {
         // unload all service component we loaded from our "loadServiceComponents" method.
     }
 }
 
 | Modifier and Type | Optional Element and Description | 
|---|---|
| java.lang.String | changedReturns the callback method to be invoked when the service have changed. | 
| java.lang.String | filterReturns the filter dependency | 
| java.lang.String | nameThe name used when dynamically configuring this dependency from the init method. | 
| boolean | propagateSpecifies if the manifest headers from the bundle should be propagated to 
 the service properties. | 
| java.lang.String | removedReturns the callback method to invoke when the service is lost. | 
| boolean | requiredReturns whether the dependency is required or not. | 
| int | stateMaskReturns the bundle state mask | 
public abstract java.lang.String changed
public abstract java.lang.String removed
public abstract boolean required
public abstract java.lang.String filter
public abstract int stateMask
public abstract boolean propagate
public abstract java.lang.String name
filter and required flag from the Service's init method.
 All unnamed dependencies will be injected before the init() method; so from the init() method, you can
 then pick up whatever information needed from already injected (unnamed) dependencies, and configure dynamically
 your named dependencies, which will then be calculated once the init() method returns.