Annotation Interface OSGiBundle
A method or field of type
BundleContext and annotated with
OSGiBundle will be injected with the BundleContext from the bundle
containing the class if the bundle's state is Bundle.ACTIVE.
If the method or field type is of Bundle, the bundle containing the
class will be injected even for bundles in the Bundle.RESOLVED state.
The Bundle injected will be the Bundle that supplied the
class of the object instance. For example, in:
class A {
@Inject
@OSGiBundle
BundleContext context;
}
class B extends A {
}
ContextInjectionFactory.make(B.class) will inject the
BundleContext for the bundle that supplies class B, not class A.- Since:
- 0.16