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 Details

    • SRV_RANKING

      public static Comparator<org.osgi.framework.ServiceReference<?>> SRV_RANKING
      Implements a comparator to sort arrays and sets according to the specification of the service.ranking property. 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:
      • < 0 if obj1 has higher ranking than obj2
      • == 0 if obj1 and obj2 reference the same service
      • > 0 if obj1 has lower ranking than obj2
    • CM_RANKING

      public static Comparator<org.osgi.framework.ServiceReference<?>> CM_RANKING
      Implements a comparator to sort arrays and sets according to the specification of the service.cmRanking property 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:
      • < 0 if obj1 has lower ranking than obj2
      • == 0 if obj1 and obj2 have the same ranking
      • > 0 if obj1 has higher ranking than obj2
  • Constructor Details

    • RankingComparator

      public RankingComparator()
  • Method Details

    • getInteger

      protected int getInteger(org.osgi.framework.ServiceReference<?> sr, String property)
    • getLong

      protected long getLong(org.osgi.framework.ServiceReference<?> sr, String property)