Class ComparableVersion
java.lang.Object
org.spongepowered.plugin.meta.version.ComparableVersion
- All Implemented Interfaces:
Comparable<ComparableVersion>
Generic implementation of version comparison.
Features:
- mixing of '
-
' (hyphen) and '.
' (dot) separators, - transition between characters and digits also constitutes a separator:
1.0alpha1 => [1, 0, alpha, 1]
- unlimited number of version components,
- version components in the text can be digits or strings,
- strings are checked for well-known qualifiers and the qualifier ordering is used for version ordering.
Well-known qualifiers (case insensitive) are:
alpha
ora
beta
orb
milestone
orm
rc
orcr
snapshot
(the empty string)
orga
orfinal
sp
- a hyphen usually precedes a qualifier, and is always less important than something preceded with a dot.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
boolean
Returns the first integer in thisComparableVersion
.Returns the first string in thisComparableVersion
.int
hashCode()
static void
Main to test version parsing and comparison.final void
parseVersion
(String version) toString()
-
Constructor Details
-
ComparableVersion
-
-
Method Details
-
parseVersion
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ComparableVersion>
-
toString
-
getCanonical
-
equals
-
hashCode
public int hashCode() -
main
Main to test version parsing and comparison.- Parameters:
args
- the version strings to parse and compare
-
getFirstString
Returns the first string in thisComparableVersion
. Usually this refers to the qualifier of the version.- Returns:
- The first string, or null if not found
-
getFirstInteger
Returns the first integer in thisComparableVersion
. Usually this refers to the major version.- Returns:
- The first integer, or null if not found
-