Package org.opends.server.util
Class BuildVersion
- java.lang.Object
-
- org.opends.server.util.BuildVersion
-
- All Implemented Interfaces:
Comparable<BuildVersion>
@PublicAPI(stability=VOLATILE, mayInstantiate=false, mayExtend=false, mayInvoke=true) public final class BuildVersion extends Object implements Comparable<BuildVersion>
Represents a particular version of OpenDJ useful for making comparisons between versions.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BuildVersionbinaryVersion()Returns the build version as specified by the dynamic constants.static voidcheckVersionMismatch()Checks if the binary version is the same than the instance version.intcompareTo(BuildVersion version)booleanequals(Object obj)intgetMajorVersion()Returns the major release version number.intgetMinorVersion()Returns the minor release version number.intgetPointVersion()Returns the point release version number.StringgetRevision()Returns the VCS revision.inthashCode()static BuildVersioninstanceVersion()Reads the instance version from config/buildinfo.booleanisNewerThan(BuildVersion version)Returnstrueif the version is newer than the provided version.booleanisOlderThan(BuildVersion version)Returnstrueif the version is older than the provided version.StringtoString()StringtoStringNoRevision()Returns a string representation of the BuildVersion including the major, minor and point versions, but excluding the revision number.static BuildVersionvalueOf(String s)Parses the string argument as a build version.
-
-
-
Method Detail
-
binaryVersion
public static BuildVersion binaryVersion()
Returns the build version as specified by the dynamic constants.- Returns:
- The build version as specified by the dynamic constants.
-
instanceVersion
public static BuildVersion instanceVersion() throws InitializationException
Reads the instance version from config/buildinfo.- Returns:
- The instance version from config/buildinfo.
- Throws:
InitializationException- If an error occurred while reading or parsing the version.
-
checkVersionMismatch
public static void checkVersionMismatch() throws InitializationExceptionChecks if the binary version is the same than the instance version.- Throws:
InitializationException- Sends an exception if the version mismatch.
-
valueOf
public static BuildVersion valueOf(String s) throws IllegalArgumentException
Parses the string argument as a build version. The string must be of the form:major.minor.point[.rev]
- Parameters:
s- The string to be parsed as a build version.- Returns:
- The parsed build version.
- Throws:
IllegalArgumentException- If the string does not contain a parsable build version.
-
compareTo
public int compareTo(BuildVersion version)
- Specified by:
compareToin interfaceComparable<BuildVersion>
-
getMajorVersion
public int getMajorVersion()
Returns the major release version number.- Returns:
- The major release version number.
-
getMinorVersion
public int getMinorVersion()
Returns the minor release version number.- Returns:
- The minor release version number.
-
getPointVersion
public int getPointVersion()
Returns the point release version number.- Returns:
- The point release version number.
-
getRevision
public String getRevision()
Returns the VCS revision.- Returns:
- The VCS revision.
-
toStringNoRevision
public String toStringNoRevision()
Returns a string representation of the BuildVersion including the major, minor and point versions, but excluding the revision number.- Returns:
- a string representation excluding the revision number
-
isNewerThan
public boolean isNewerThan(BuildVersion version)
Returnstrueif the version is newer than the provided version.- Parameters:
version- The version to be compared- Returns:
trueif the version is newer than the provided version.
-
isOlderThan
public boolean isOlderThan(BuildVersion version)
Returnstrueif the version is older than the provided version.- Parameters:
version- The version to be compared- Returns:
trueif the version is older than the provided version.
-
-