Niclas Hedhman wrote:
> On Friday 18 April 2008 18:31, Rickard Öberg wrote:
> 
> public class ServiceConsumer
> {
>      private ServiceSelector<TestService> selector;
> 
>      public ServiceConsumer( @Uses String id, @Service
>   Iterable<ServiceReference<TestService>> serviceRefs)
>      {
>          selector = new ServiceSelector<TestService>(serviceRefs, id);
>      }
> 
>      public TestService getService()
>      {
>          return selector.get();
>      }
> }
> 
> Are we talking about a generic ServiceSelector class, or a pattern of how to 
> do things? I guess I don't get it...

ServiceSelector would be generic. Feed it an iterable of service refs 
and the desired id and it will get it for you. Very simple, but 
practical. And the filtering rule could be changed to something else, as 
I mentioned.

/Rickard


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to