Package org.adempiere.base.ds
Class ServiceRankingComparator
java.lang.Object
org.adempiere.base.ds.ServiceRankingComparator
- All Implemented Interfaces:
Serializable
,Comparator<org.osgi.framework.ServiceReference<?>>
public final class ServiceRankingComparator
extends Object
implements Comparator<org.osgi.framework.ServiceReference<?>>, Serializable
Service Reference Comparator.
This comparator follows OSGi Ranking policy.
This comparator follows OSGi Ranking policy.
- Author:
- hengsin
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ServiceRankingComparator
share service ranking comparator instance -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(org.osgi.framework.ServiceReference<?> serviceReference1, org.osgi.framework.ServiceReference<?> serviceReference2) Compares two service reference.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
INSTANCE
share service ranking comparator instance
-
-
Method Details
-
compare
public int compare(org.osgi.framework.ServiceReference<?> serviceReference1, org.osgi.framework.ServiceReference<?> serviceReference2) Compares two service reference.- Specified by:
compare
in interfaceComparator<org.osgi.framework.ServiceReference<?>>
- Parameters:
serviceReference1
- service reference 1serviceReference2
- service reference 2- Returns:
-1
if service reference 1 service.ranking value is higher than service reference 2,1
otherwise. (i.e for sorting in descending order of service.ranking value)- See Also:
-