In all iPOJO examples I’ve seen, the @Bind and @Unbind callbacks take only the service instance as an argument, i.e.
// @Requires
// private Foo foo;
@Bind
public void bindFoo(Foo foo) { ... }
@Unbind
public void unbindFoo(Foo foo) { ... }
Blueprint also allows you to have
public void bindFoo(ServiceReference reference) { ... }
public void bindFoo(Foo foo, Map<String, Object> properties) { ... }
Can iPOJO callbacks also get access to service properties or ServiceReference? Or should whiteboard handler be used for this instead?
Callbacks can have one of these signatures:
(method(Service svc))
reference appearing or disappearing (method(ServiceReference ref))
(method(Service svc, ServiceReference ref))
properties))
So, are supported:
So no problem to access the service properties. Except if you really need the ServiceReference, it’s probably better to not use this OSGi-specific object (reduce testability).