Class VersionNumber

java.lang.Object
org.spongepowered.asm.util.VersionNumber
All Implemented Interfaces:
Serializable, Comparable<VersionNumber>

public final class VersionNumber extends Object implements Comparable<VersionNumber>, Serializable
Represents a software version number in major.minor.revision.build format as a sequence of four shorts packed into a long. This is to facilitate meaningful comparison between version numbers.
See Also:
  • Field Details

    • NONE

      public static final VersionNumber NONE
      Represents no version number or a version number which could not be parsed
  • Method Details

    • 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 String getSuffix()
      Get the suffix from this version
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(VersionNumber other)
      Specified by:
      compareTo in interface Comparable<VersionNumber>
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • parse

      public static VersionNumber parse(String version)
      Parse a version number specified as a string
      Parameters:
      version - Version number to parse
      Returns:
      Version number
    • parse

      public static VersionNumber parse(String version, String defaultVersion)
      Parse a version number specified as a string and return default if parsing fails
      Parameters:
      version - Version number to parse
      defaultVersion - Version number to return if parse fails
      Returns:
      Version number