Package org.alfresco.util
Class VersionNumber
java.lang.Object
org.alfresco.util.VersionNumber
- All Implemented Interfaces:
Serializable
,Comparable<VersionNumber>
@AlfrescoPublicApi
public final class VersionNumber
extends Object
implements Comparable<VersionNumber>, Serializable
Immutable class to encapsulate a version number string.
A valid version number string can be made up of any number of numberical parts
all delimited by '.'.
- Author:
- Roy Wetherall
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final VersionNumber
A convenient '999' versionstatic final VersionNumber
A convenient '0' version -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(VersionNumber obj) Compares the passed version to this.boolean
Equals implementationint
getPart
(int index) Helper method to the the part based on the index, if an invalid index is supplied 0 is returned.int[]
getParts()
Get the various parts of the versionint
hashCode()
Hash code implementationtoString()
-
Field Details
-
VERSION_ZERO
A convenient '0' version -
VERSION_BIG
A convenient '999' version
-
-
Constructor Details
-
VersionNumber
Constructror, expects a valid version string. A AlfrescoRuntimeException will be throw if an invalid version is encountered.- Parameters:
version
- the version string
-
-
Method Details
-
getParts
public int[] getParts()Get the various parts of the version- Returns:
- array containing the parts of the version
-
compareTo
Compares the passed version to this. Determines whether they are equal, greater or less than this version.- Specified by:
compareTo
in interfaceComparable<VersionNumber>
- Parameters:
obj
- the other version number- Returns:
- -1 if the passed version is less that this, 0 if they are equal, 1 if the passed version is greater
-
getPart
public int getPart(int index) Helper method to the the part based on the index, if an invalid index is supplied 0 is returned.- Parameters:
index
- the index- Returns:
- the part value, 0 if the index is invalid
-
hashCode
public int hashCode()Hash code implementation -
equals
Equals implementation -
toString
-