Class Version
java.lang.Object
com.couchbase.client.java.util.features.Version
- All Implemented Interfaces:
Comparable<Version>
public class Version extends Object implements Comparable<Version>
Representation of a software version, up to major.minor.patch granularity.
- Since:
- 2.1.0
- Author:
- Simon Baslé
-
Field Summary
Fields Modifier and Type Field Description static Version
NO_VERSION
-
Constructor Summary
Constructors Constructor Description Version(int major, int minor, int patch)
-
Method Summary
-
Field Details
-
NO_VERSION
-
-
Constructor Details
-
Version
public Version(int major, int minor, int patch)
-
-
Method Details
-
major
public int major() -
minor
public int minor() -
patch
public int patch() -
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<Version>
-
toString
-
parseVersion
Parses aString
into aVersion
. This expects a version string in the form of "X[.Y[.Z]][anything]". That is a major number, followed optionally by a minor only or a minor + a patch revision, everything after that being completely ignored. For example, the following version strings are valid: - "3.a.2", but note it is considered only a major version since there's a char where minor number should be (parsed into 3.0.0) - "2" (2.0.0) - "3.11" (3.11) - "1.2.3-SNAPSHOT-12.10.2014" (1.2.3) Bad version strings cause anIllegalArgumentException
, whereas a null one will cause aNullPointerException
.- Parameters:
versionString
- the string to parse into a Version.- Returns:
- the major.minor.patch Version corresponding to the string.
- Throws:
IllegalArgumentException
- if the string cannot be correctly parsed into a VersionNullPointerException
- if the string is null.
-