Package org.nuxeo.runtime
Class Version
java.lang.Object
org.nuxeo.runtime.Version
- All Implemented Interfaces:
Serializable,Comparable<Version>
A version consists of three fields, denoting the major version, the minor version, and the update version. Example:
3.1.2.
- Author:
- Bogdan Stefanescu
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVersion(int major, int minor, int update) Creates a new version object given the major, minor and update version numbers. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanintGets the major version field.intGets the minor version field.intGets the update version field.inthashCode()booleanTests if the current version is equal to the given one.booleanisGreaterOrEqualThan(Version version) Tests if the current version is greater or equal to the given one.booleanisGreaterThan(Version version) Tests if the current version is greater than the given one.static VersionparseString(String version) Creates a new version object given a string representation of the version.toString()Gets the string representation of this version.
-
Field Details
-
ZERO
-
MIN
-
MAX
-
-
Constructor Details
-
Version
public Version(int major, int minor, int update) Creates a new version object given the major, minor and update version numbers.- Parameters:
major- the major versionminor- the minor versionupdate- the update version
-
-
Method Details
-
parseString
Creates a new version object given a string representation of the version.- Parameters:
version- the version string- Returns:
- the version object
- Throws:
NumberFormatException- if the version string is invalid
-
isGreaterThan
Tests if the current version is greater than the given one.- Parameters:
version- the version to compare to the current one- Returns:
- true if the current version is greater, false otherwise
-
isGreaterOrEqualThan
Tests if the current version is greater or equal to the given one.- Parameters:
version- the version to compare to the current one- Returns:
- if the current version is greater or equal, false otherwise
-
isEqualTo
Tests if the current version is equal to the given one.- Parameters:
version- the version to compare to the current one- Returns:
- if the current version is equal to the given one, false otherwise
-
getMinorVersion
public int getMinorVersion()Gets the minor version field.- Returns:
- the minor
-
getMajorVersion
public int getMajorVersion()Gets the major version field.- Returns:
- the major
-
getUpdateVersion
public int getUpdateVersion()Gets the update version field.- Returns:
- the update
-
toString
Gets the string representation of this version.The string representation can be used in
parseString(String)to create a version object. -
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<Version>
-