Package org.jivesoftware.util
Class JavaSpecVersion
- java.lang.Object
-
- org.jivesoftware.util.JavaSpecVersion
-
- All Implemented Interfaces:
Comparable<JavaSpecVersion>
public final class JavaSpecVersion extends Object implements Comparable<JavaSpecVersion>
Holds version information for Java specification (a major and minor version, eg: 1.8, or just a number, eg: 11). For comparison purposes, only the minor version number is used.- Author:
- Guus der Kinderen, guus.der.kinderen@gmail.com
-
-
Constructor Summary
Constructors Constructor Description JavaSpecVersion(int major, int minor)Create a new version information object.JavaSpecVersion(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(JavaSpecVersion that)booleanequals(Object o)StringgetVersionString()Returns the version number of this instance of Openfire as a String (ie major.minor.revision).inthashCode()booleanisNewerThan(JavaSpecVersion otherVersion)Convenience method for comparing versionsStringtoString()
-
-
-
Constructor Detail
-
JavaSpecVersion
public JavaSpecVersion(int major, int minor)Create a new version information object.- Parameters:
major- the major release number.minor- the minor release number.
-
JavaSpecVersion
public JavaSpecVersion(CharSequence source)
Create a new version from a simple version string (e.g. "1.8")- 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
-
isNewerThan
public boolean isNewerThan(JavaSpecVersion otherVersion)
Convenience method for comparing versions- Parameters:
otherVersion- a version to compare against- Returns:
trueif this version is newer, otherwisefalse
-
compareTo
public int compareTo(JavaSpecVersion that)
- Specified by:
compareToin interfaceComparable<JavaSpecVersion>
-
-