Hi,
you can use the @Services annotation which allows you to embed several
@Service annotations.
Regards
Carsten
Daniel Bimschas wrote:
> Hi there!
>
> I just found an unsupported use case that I'm "stuck" with. Consider a
> class A that implements the interfaces B, C and EventHandler. For B and
> C class A wants to be registered as service declaratively. Therefore I
> use the scr annotations. For interface EventHandler I want to register
> my service programmatically, as it needs to specify a filter
> expression). Based on the available annotations I'm not able to do it.
>
> @Service
> @Component(...)
> public class A implements B, C, EventHandler {
>
> public void activate(ComponentContext context) {
> Dictionary d = new Hashtable();
> d.put(EventConstants.EVENT_TOPIC, "...");
> d.put(EventConstants.EVENT_FILTER, "(...)");
> context.registerService( EventHandler.class.getName(), this, d);
> // ...
> }
>
> // ...
>
> }
>
> I think there's no way to do it, as I cannot specify multiple @Service
> annotations and the value-param of @Service only takes exactly one
> Class<?> parameter, not an array or sth. Another possibility would be a
> list of excluded interfaces, if auto-detection was used.
>
> Is there a way to do somehow else? Or is this in fact an unsupported use
> case?
>
> Kind regards,
> Daniel Bimschas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Carsten Ziegeler
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]