felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@adobe.com>
Subject Re: @Reference with Multiple Cardinality
Date Sat, 10 Nov 2012 18:26:04 GMT

Generally you have to provide the bind and unbind methods in your code unless the @Reference
has single cardinality, in which case the methods are automatically generated, or if you define
the @Reference to not have bind and unbind methods.

In your case, you have to ceate the bind and unbind methods.


Am 10.11.2012 um 17:39 schrieb David G.:

> Can @Reference annotations be used to directly gain access to multiple Service objects?

> I tried the following, using List, Arrays, and Vectors as the data types to no avail;
> @Reference(cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE)
> List<SomeService> someServices;
> ...The build complained about the bind and unbind methods not undefined (which is true
in my experiment class). 
> Are bind/unbind required to access multiple services from a single reference; "manually"
retrieving service objects via service refs?
> If there is a shortcut as described above using @Reference (or some other mechanism),
how is the order determined (ranking?) 
> All i could find wrt to using @Reference is on the felix site [1] .. 
> Thanks!
> [1] http://felix.apache.org/site/scr-annotations.html#SCRAnnotations-Reference
> -- 
> David Gonzalez
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org

View raw message