Package org.jivesoftware.util
Class Version
- java.lang.Object
-
- org.jivesoftware.util.Version
-
- All Implemented Interfaces:
Comparable<Version>
public final class Version extends Object implements Comparable<Version>
Holds version information for Openfire.- Author:
- Iain Shigeoka
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVersion.ReleaseStatusA class to represent the release status of the server.
-
Constructor Summary
Constructors Constructor Description Version(int major, int minor, int micro, Version.ReleaseStatus status, int statusVersion)Create a new version information object.Version(CharSequence source)Create a new version from a simple version string (e.g.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Version that)booleanequals(Object o)intgetMajor()Obtain the major release number for this product.intgetMicro()Obtain the micro release number for this product.intgetMinor()Obtain the minor release number for this product.Version.ReleaseStatusgetStatus()Returns the release status of this product.intgetStatusVersion()Obtain the status release number for this product.StringgetVersionString()Returns the version number of this instance of Openfire as a String (ie major.minor.revision).inthashCode()VersionignoringReleaseStatus()booleanisNewerThan(Version otherVersion)Convenience method for comparing versionsStringtoString()
-
-
-
Constructor Detail
-
Version
public Version(int major, int minor, int micro, Version.ReleaseStatus status, int statusVersion)Create a new version information object.- Parameters:
major- the major release number.minor- the minor release number.micro- the micro release number.status- the status of the release.statusVersion- status release number or -1 to indicate none.
-
Version
public Version(CharSequence source)
Create a new version from a simple version string (e.g. "3.9.3")- Parameters:
source- the version string
-
-
Method Detail
-
getVersionString
public String getVersionString()
Returns the version number of this instance of Openfire as a String (ie major.minor.revision).- Returns:
- The version as a string
-
getStatus
public Version.ReleaseStatus getStatus()
Returns the release status of this product.- Returns:
- the release status of this product.
-
getMajor
public int getMajor()
Obtain the major release number for this product.- Returns:
- The major release number 1.x.x
-
getMinor
public int getMinor()
Obtain the minor release number for this product.- Returns:
- The minor release number x.1.x
-
getMicro
public int getMicro()
Obtain the micro release number for this product.- Returns:
- The micro release number x.x.1
-
getStatusVersion
public int getStatusVersion()
Obtain the status release number for this product. For example, if the release status is alpha the release may be 5 resulting in a release status of Alpha 5.- Returns:
- The status version or -1 if none is set.
-
isNewerThan
public boolean isNewerThan(Version otherVersion)
Convenience method for comparing versions- Parameters:
otherVersion- a version to compare against- Returns:
trueif this version is newer, otherwisefalse
-
compareTo
public int compareTo(Version that)
- Specified by:
compareToin interfaceComparable<Version>
-
ignoringReleaseStatus
public Version ignoringReleaseStatus()
-
-