org.eclipse.gemini.blueprint.service.importer.support.internal.util
Class ServiceReferenceComparator
java.lang.Object
org.eclipse.gemini.blueprint.service.importer.support.internal.util.ServiceReferenceComparator
- All Implemented Interfaces:
- Serializable, Comparator
public class ServiceReferenceComparator
- extends Object
- implements Comparator, Serializable
Default comparator for sorted collections. It uses the service id property of an OSGi service to determine the order.
Thus, by using this comparator, the services added to a collection will be sorted in the order in which they are
published to the OSGi platform.
This comparator version, provides natural ordering for service references for pre OSGI 4.1 platforms,
using the contract from OSGi 4.1 spec:
If this ServiceReference and the specified ServiceReference have the same service id they are equal.
This ServiceReference is less than the specified ServiceReference if it has a lower service ranking and greater if it
has a higher service ranking. Otherwise, if this ServiceReference and the specified ServiceReference have the same
service ranking, this ServiceReference is less than the specified ServiceReference if it has a higher service id and
greater if it has a lower service id.
- Author:
- Costin Leau
- See Also:
Comparator
,
Serialized Form
ServiceReferenceComparator
public ServiceReferenceComparator()
compare
public int compare(Object o1,
Object o2)
- Specified by:
compare
in interface Comparator
equals
public boolean equals(Object obj)
- Specified by:
equals
in interface Comparator
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
Copyright © 2006-2013. All Rights Reserved.