Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.runtime
Class Version

java.lang.Object
  extended by 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

Field Summary
static Version MAX
           
static Version MIN
           
static Version ZERO
           
 
Constructor Summary
Version(int major, int minor, int update)
          Creates a new version object given the major, minor and update version numbers.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final Version ZERO

MIN

public static final Version MIN

MAX

public static final Version MAX
Constructor Detail

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 version
minor - the minor version
update - the update 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.

Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

compareTo

public int compareTo(Version v)
Specified by:
compareTo in interface Comparable<Version>

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.