org.mule.tools.tooling.maven
Class VersionComparator

java.lang.Object
  extended by org.mule.tools.tooling.maven.VersionComparator
All Implemented Interfaces:
Comparator<String>

public class VersionComparator
extends Object
implements Comparator<String>


Constructor Summary
VersionComparator()
           
 
Method Summary
 int compare(String version, String otherVersion)
          Compares version to another given version, taking the numeric, dot-separated part and comparing them, major, minor, etcetera.
Version suffixes (milestones and such) should be compared separately.
 
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

VersionComparator

public VersionComparator()
Method Detail

compare

public int compare(String version,
                   String otherVersion)
Compares version to another given version, taking the numeric, dot-separated part and comparing them, major, minor, etcetera.
Version suffixes (milestones and such) should be compared separately.

Examples:
(comparator for "3.4-M3").compareVersionTo("3.4") == 0
(comparator for "3.4-M3").compareVersionTo("3.4-M5") == 0
(comparator for "3.4-M3").compareVersionTo("3.3.0") > 0
(comparator for "3.4-M3").compareVersionTo("4") < 0
(comparator for "3.4-M3").compareVersionTo("4.3.2") < 0
(comparator for "3.4-M3").compareVersionTo("illegal") ==> IllegalArgumentException
This method assumes in all cases that the version in this server definition object is valid and well formed

Specified by:
compare in interface Comparator<String>
Parameters:
otherVersion -


Copyright © 2014. All Rights Reserved.