Class Version

  • All Implemented Interfaces:
    java.lang.Comparable<Version>

    public class Version
    extends java.lang.Object
    implements java.lang.Comparable<Version>
    A Version is used for the versioning of an Artifact.

    The version should be a series of "." separated numbers and strings. For a development version, the version should end with "-SNAPSHOT". The most common case is semantic versioning which follows the format "major.minor.incremental".

    • Constructor Summary

      Constructors 
      Constructor Description
      Version​(java.lang.String version)
      Constructs a version with the version string.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Version otherVersion)
      boolean equals​(java.lang.Object o)
      int getIncrementalVersion()
      Returns the incremental version (assuming major.minor.incremental...) of the version.
      int getMajorVersion()
      Returns the major version (assuming major.minor.incremental...) of the version.
      int getMinorVersion()
      Returns the minor version (assuming major.minor.incremental...) of the version.
      int hashCode()
      boolean isSnapshot()
      Returns true if this is a snapshot version.
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Version

        public Version​(java.lang.String version)
        Constructs a version with the version string.
        Parameters:
        version - the version string
    • Method Detail

      • compareTo

        public int compareTo​(Version otherVersion)
        Specified by:
        compareTo in interface java.lang.Comparable<Version>
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getMajorVersion

        public int getMajorVersion()
        Returns the major version (assuming major.minor.incremental...) of the version.
        Returns:
        the major version
      • getMinorVersion

        public int getMinorVersion()
        Returns the minor version (assuming major.minor.incremental...) of the version.
        Returns:
        the minor version
      • getIncrementalVersion

        public int getIncrementalVersion()
        Returns the incremental version (assuming major.minor.incremental...) of the version.
        Returns:
        the incremental version
      • isSnapshot

        public boolean isSnapshot()
        Returns true if this is a snapshot version.
        Returns:
        true if this is a snapshot version
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object