Hi,

with the Felix SCR annotations, @Reference on a field only handles unary
cardinality. If you want to handle multiple cardinality you have to
implement the bind/unbind methods similar to the example you gave.

In general, I suggest to use the official DS annotations instead of the
SCR ones, as the latest version from R6 has now finally all the features
from the Felix SCR annotations (in slightly different flavour) and also
supports the kind of field annotations you're looking for.

Regards
Carsten

Jonathan Vila Lopez wrote
> Hi all.
> 
> I would like to find the documentation about Felix SCR annotation
> Reference that explains the injection for a list of services.
> 
>     @Reference
>     List<ArticleFilter> list;
> 
> ​Is that correct ?
> 
> I've found in other places something like :
> 
> @Reference(referenceInterface = AspectRatioCalculator.class, cardinality = 
> ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
> private final Map<String, AspectRatioCalculator> aspectRatioCalculators = new 
> ConcurrentHashMap<String, AspectRatioCalculator>();
> 
> protected void bindAspectRatioCalculators(final AspectRatioCalculator arc) {
>     this.aspectRatioCalculators.put(arc.getResourceType(), arc);
> }
> 
> protected void unbindAspectRatioCalculators(final AspectRatioCalculator arc) {
>     this.aspectRatioCalculators.remove(arc.getResourceType());
> }
> 
> 
> ​And in this last case I don't know if the bind/unbind methods are a
> must, if not I can use a list of services injections using a Map ? if
> so, what is the first type String for ?....
> 
> ​So, is there all this information written in any place in the
> documentation ?
> 
> Thank you.​
> 
> 
> 
> Inline image 2
> 
>       
> 
> * Jonathan Vila  
>  **_*_<https://www.twitter.com/jonathan_vila>_**_ 
> _**_<http://www.linkedin.com/in/jonathanvila>_*_**
> **_ [email protected] <mailto:[email protected]>
> _*
> 
>  
> 


 
-- 
Carsten Ziegeler
Adobe Research Switzerland
[email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to