kwin commented on a change in pull request #10:
URL:
https://github.com/apache/sling-org-apache-sling-servlets-post/pull/10#discussion_r560063474
##########
File path:
src/main/java/org/apache/sling/servlets/post/impl/helper/SortedByRankingList.java
##########
@@ -0,0 +1,106 @@
+/*
Review comment:
Please rather use DS field injection which orders automatically by
ranking
> For a reference with multiple cardinality, a field must be a collection of
one of the following types:
Collection
List
A subtype of Collection - This type can only be used for dynamic references
using the update reference field option. The component instance must initialize
the field to a collection object in its constructor.
(https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.component.html#service.component-field.injection)
and
> For a reference with multiple cardinality, the type of the field must be
Collection or List. If the field has a different type, SCR must log an error
message with the Log Service, if present, and the field must not be modified.
Before the component instance is activated, SCR must set the field value with a
new mutable collection that must contain the initial set of bound services
sorted using the same ordering as ServiceReference.compareTo based upon service
ranking and service id. The collection may be empty if the reference has
optional cardinality and there are no bound services. If the reference is
dynamic, when there is a change in the set of bound services or the service
properties of a bound service are modified and the collection holds service
properties, SCR must replace the field value with a new mutable collection that
must contain the updated set of bound services sorted using the same ordering
as ServiceReference.compareTo based upon service ranking and service id.
The new collection may be empty if the reference has optional cardinality and
there are no bound services.
(https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.component.html#d0e37828
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]