org.rhq.core.domain.content
Class PackageVersion.DefaultPackageVersionComparator

java.lang.Object
  extended by org.rhq.core.domain.content.PackageVersion.DefaultPackageVersionComparator
All Implemented Interfaces:
Serializable, Comparator<PackageVersion>
Enclosing class:
PackageVersion

public static class PackageVersion.DefaultPackageVersionComparator
extends Object
implements Comparator<PackageVersion>, Serializable

This is a default Comparator implementation for package versions. If the package versions being compared both have non-null versions an OSGiVersionComparator is used to compare them. If it fails or if one of the versions is null the package versions are compared by file created date. If the creation date is not specified for one of the package versions, they proclaimed equal.

Note that this comparator is *INCONSISTENT* with equals() and therefore care should be taken when using it with sets and maps (read this documentation).

See Also:
Serialized Form

Constructor Summary
PackageVersion.DefaultPackageVersionComparator()
           
 
Method Summary
 int compare(PackageVersion p1, PackageVersion p2)
           
 
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
 

Constructor Detail

PackageVersion.DefaultPackageVersionComparator

public PackageVersion.DefaultPackageVersionComparator()
Method Detail

compare

public int compare(PackageVersion p1,
                   PackageVersion p2)
Specified by:
compare in interface Comparator<PackageVersion>


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.