Package org.spongepowered.asm.util
Class VersionNumber
- java.lang.Object
-
- org.spongepowered.asm.util.VersionNumber
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<VersionNumber>
public final class VersionNumber extends java.lang.Object implements java.lang.Comparable<VersionNumber>, java.io.Serializable
Represents a software version number inmajor.minor.revision.buildformat as a sequence of four shorts packed into a long. This is to facilitate meaningful comparison between version numbers.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static VersionNumberNONERepresents no version number or a version number which could not be parsed
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(VersionNumber other)booleanequals(java.lang.Object other)shortgetMajor()Get the major version from this version numbershortgetMinor()Get the minor version from this version numbershortgetPatch()Get the patch from this version numbershortgetRevision()Get the revision from this version numberjava.lang.StringgetSuffix()Get the suffix from this versioninthashCode()static VersionNumberparse(java.lang.String version)Parse a version number specified as a stringstatic VersionNumberparse(java.lang.String version, java.lang.String defaultVersion)Parse a version number specified as a string and return default if parsing failsjava.lang.StringtoString()
-
-
-
Field Detail
-
NONE
public static final VersionNumber NONE
Represents no version number or a version number which could not be parsed
-
-
Method Detail
-
getMajor
public short getMajor()
Get the major version from this version number
-
getMinor
public short getMinor()
Get the minor version from this version number
-
getPatch
public short getPatch()
Get the patch from this version number
-
getRevision
public short getRevision()
Get the revision from this version number
-
getSuffix
public java.lang.String getSuffix()
Get the suffix from this version
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(VersionNumber other)
- Specified by:
compareToin interfacejava.lang.Comparable<VersionNumber>
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
parse
public static VersionNumber parse(java.lang.String version)
Parse a version number specified as a string- Parameters:
version- Version number to parse- Returns:
- Version number
-
parse
public static VersionNumber parse(java.lang.String version, java.lang.String defaultVersion)
Parse a version number specified as a string and return default if parsing fails- Parameters:
version- Version number to parsedefaultVersion- Version number to return if parse fails- Returns:
- Version number
-
-