com.datastax.driver.core
Class VersionNumber

java.lang.Object
  extended by com.datastax.driver.core.VersionNumber
All Implemented Interfaces:
Comparable<VersionNumber>

public class VersionNumber
extends Object
implements Comparable<VersionNumber>

A version number in the form X.Y.Z with an optional pre-release label (like 1.2.14-SNAPSHOT).

Version numbers compare the usual way, the major number (X) is compared first, then the minor one (Y) and then the patch level one (Z). Lastly, versions with pre-release sorts before the versions that don't have one, and labels are sorted alphabetically if necessary.


Method Summary
 int compareTo(VersionNumber other)
           
 boolean equals(Object o)
           
 int getMajor()
          The major version number.
 int getMinor()
          The minor version number.
 int getPatch()
          The patch version number.
 String getPreReleaseLabel()
          The pre-release label if relevant, i.e.
 int hashCode()
           
static VersionNumber parse(String version)
          Parse a version from a string (of the form X.Y.Z[-label]).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

parse

public static VersionNumber parse(String version)
Parse a version from a string (of the form X.Y.Z[-label]).

We also parse shorter versions like X.Y[-label] for convenience, but this parse the same as X.Y.0[-label].

Parameters:
version - the string to parse
Throws:
IllegalArgumentException - if the provided string does not represent a valid version

getMajor

public int getMajor()
The major version number.

Returns:
the major version number, i.e. X in X.Y.Z.

getMinor

public int getMinor()
The minor version number.

Returns:
the minor version number, i.e. Y in X.Y.Z.

getPatch

public int getPatch()
The patch version number.

Returns:
the patch version number, i.e. Z in X.Y.Z.

getPreReleaseLabel

public String getPreReleaseLabel()
The pre-release label if relevant, i.e. label in X.Y.Z-label.

Returns:
the pre-release label or null if the version number doesn't have one.

compareTo

public int compareTo(VersionNumber other)
Specified by:
compareTo in interface Comparable<VersionNumber>

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014. All rights reserved.