Package org.apache.felix.cm.impl
Class RankingComparator
java.lang.Object
org.apache.felix.cm.impl.RankingComparator
- All Implemented Interfaces:
Comparator<org.osgi.framework.ServiceReference<?>>
public abstract class RankingComparator
extends Object
implements Comparator<org.osgi.framework.ServiceReference<?>>
The
RankingComparator may be used to maintain sorted
sets or to sort arrays such that the first element in the set or
array is the one to use first and the last elements the one to
use last.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Comparator<org.osgi.framework.ServiceReference<?>> Implements a comparator to sort arrays and sets according to the specification of theservice.cmRankingproperty in the Configuration Admin specification.static Comparator<org.osgi.framework.ServiceReference<?>> Implements a comparator to sort arrays and sets according to the specification of theservice.rankingproperty. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intgetInteger(org.osgi.framework.ServiceReference<?> sr, String property) protected longMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
compare, equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
SRV_RANKING
Implements a comparator to sort arrays and sets according to the specification of theservice.rankingproperty. This results in collections whose first element has the highest ranking and the last element has the lowest ranking. Thus the results of this comparator are as follows:< 0if obj1 has higher ranking than obj2== 0if obj1 and obj2 reference the same service> 0if obj1 has lower ranking than obj2
-
CM_RANKING
Implements a comparator to sort arrays and sets according to the specification of theservice.cmRankingproperty in the Configuration Admin specification. This results in collections where the first element has the lowest ranking value and the last element has the highest ranking value. Order amongst elements with the same ranking value is left undefined, however we order it by service id, lowest last. Thus the results of this comparator are as follows:< 0if obj1 has lower ranking than obj2== 0if obj1 and obj2 have the same ranking> 0if obj1 has higher ranking than obj2
-
-
Constructor Details
-
RankingComparator
public RankingComparator()
-
-
Method Details
-
getInteger
-
getLong
-