Package org.nuxeo.runtime
Class Version
- java.lang.Object
-
- org.nuxeo.runtime.Version
-
- All Implemented Interfaces:
Serializable
,Comparable<Version>
public class Version extends Object implements 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Version(int major, int minor, int update)
Creates a new version object given the major, minor and update version numbers.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Version v)
boolean
equals(Object object)
int
getMajorVersion()
Gets the major version field.int
getMinorVersion()
Gets the minor version field.int
getUpdateVersion()
Gets the update version field.int
hashCode()
boolean
isEqualTo(Version version)
Tests if the current version is equal to the given one.boolean
isGreaterOrEqualThan(Version version)
Tests if the current version is greater or equal to the given one.boolean
isGreaterThan(Version version)
Tests if the current version is greater than the given one.static Version
parseString(String version)
Creates a new version object given a string representation of the version.String
toString()
Gets the string representation of this version.
-
-
-
Method Detail
-
parseString
public static Version parseString(String version)
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
public boolean isGreaterThan(Version version)
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
public boolean isGreaterOrEqualThan(Version version)
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
public boolean isEqualTo(Version version)
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
public String toString()
Gets the string representation of this version.The string representation can be used in
parseString(String)
to create a version object.
-
compareTo
public int compareTo(Version v)
- Specified by:
compareTo
in interfaceComparable<Version>
-
-