org.eclipse.rdf4j.common.app

## Class AppVersion

- java.lang.Object
- - org.eclipse.rdf4j.common.app.AppVersion

- All Implemented Interfaces:
    Comparable<AppVersion>

      public class AppVersion
      extends Object
      implements Comparable<AppVersion>

  A product version in Aduna's version format (i.e. major.minor-modifier). Where major stands for the major version number of the release, minor is the minor version number, and modifier is a modifier for the release, e.g. beta1 or RC1. Combined, this results in versions like 2.0 and 4.1-beta1.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AppVersion()` Construct an uninitialized AppVersion.
    `AppVersion(int major, int minor)` Creates a new `major.minor` version number, e.g.`1.0`.
    `AppVersion(int major, int minor, int patch)` Creates a new `major.minor.patch` version number, e.g.`1.0.1`.
    `AppVersion(int major, int minor, int patch, int milestone, String modifier)` Creates a new `major.minor.patchMmilestone-modifier` version number, e.g.`1.0.1M1-SNAPSHOT`.
    `AppVersion(int major, int minor, int patch, int milestone, String modifier, String build)` Creates a new version number
    `AppVersion(int major, int minor, int patch, String modifier)` Creates a new `major.minor.patch-modifier` version number, e.g.`1.0.1-SNAPSHOT`.
    `AppVersion(int major, int minor, String modifier)` Creates a new `major.minor-modifier` version number, e.g.`1.0-beta1`.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(AppVersion other)` Compares two version numbers according to their major, minor, patch and milestone version numbers, ordering from oldest to newest version.
    `boolean` | `equals(Object other)` Check if two versions are exactly equal, modifier is case insensitive.
    `int` | `getMajor()` Gets the version's major version number.
    `int` | `getMilestone()` Get the milestone number
    `int` | `getMinor()` Gets the version's minor version number.
    `String` | `getModifier()` Gets the version's release modifier part.
    `int` | `getPatch()` Gets the version's micro version / patch level number.
    `int` | `hashCode()`
    `boolean` | `newerThan(AppVersion other)` Checks if this version is newer than the specified version, according to the result of `compareTo(AppVersion)`.
    `boolean` | `olderThan(AppVersion other)` Checks if this version is older than the specified version, according to the result of `compareTo(AppVersion)`.
    `static AppVersion` | `parse(String versionString)` Parses a version string into a Version object.
    `void` | `setMajor(int major)` Set major number
    `void` | `setMilestone(int milestone)` Set the milestone number
    `void` | `setMinor(int minor)` Set minor number
    `void` | `setModifier(String modifier)` Set the version's release modifier part.
    `void` | `setPatch(int micro)` Sets the version's micro version / patch level number.
    `String` | `toString()` Returns the string represention of this version.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AppVersion

          public AppVersion()

      Construct an uninitialized AppVersion.

    - #### AppVersion

          public AppVersion(int major,
                            int minor)

      Creates a new `major.minor` version number, e.g.`1.0`.
      Parameters:
        `major` - major number
        `minor` - minor number

    - #### AppVersion

          public AppVersion(int major,
                            int minor,
                            int patch)

      Creates a new `major.minor.patch` version number, e.g.`1.0.1`.
      Parameters:
        `major` - major number
        `minor` - minor number
        `patch` - patch number

    - #### AppVersion

          public AppVersion(int major,
                            int minor,
                            String modifier)

      Creates a new `major.minor-modifier` version number, e.g.`1.0-beta1`.
      Parameters:
        `major` - major number
        `minor` - minor number
        `modifier` - additional string

    - #### AppVersion

          public AppVersion(int major,
                            int minor,
                            int patch,
                            String modifier)

      Creates a new `major.minor.patch-modifier` version number, e.g.`1.0.1-SNAPSHOT`.
      Parameters:
        `major` - major number
        `minor` - minor number
        `patch` - patch number
        `modifier` - additional string

    - #### AppVersion

          public AppVersion(int major,
                            int minor,
                            int patch,
                            int milestone,
                            String modifier)

      Creates a new `major.minor.patchMmilestone-modifier` version number, e.g.`1.0.1M1-SNAPSHOT`.
      Parameters:
        `major` - major number
        `minor` - minor number
        `patch` - patch number
        `milestone` - milestone number
        `modifier` - additional string

    - #### AppVersion

          public AppVersion(int major,
                            int minor,
                            int patch,
                            int milestone,
                            String modifier,
                            String build)

      Creates a new version number
      Parameters:
        `major` - major number
        `minor` - minor number
        `patch` - patch number
        `milestone` - milestone number
        `modifier` - additional string
        `build` - build string

  - ### Method Detail

    - #### getMajor

          public int getMajor()

      Gets the version's major version number.
      Returns:
        major number

    - #### setMajor

          public void setMajor(int major)

      Set major number
      Parameters:
        `major` - major number

    - #### getMinor

          public int getMinor()

      Gets the version's minor version number.
      Returns:
        minor number

    - #### setMinor

          public void setMinor(int minor)

      Set minor number
      Parameters:
        `minor` - minor number

    - #### getPatch

          public int getPatch()

      Gets the version's micro version / patch level number.
      Returns:
        patch level number

    - #### setPatch

          public void setPatch(int micro)

      Sets the version's micro version / patch level number.
      Parameters:
        `micro` - patch level number

    - #### setMilestone

          public void setMilestone(int milestone)

      Set the milestone number
      Parameters:
        `milestone` - milestone number

    - #### getMilestone

          public int getMilestone()

      Get the milestone number
      Returns:
        milestone number

    - #### getModifier

          public String getModifier()

      Gets the version's release modifier part.
      Returns:
        modifier string

    - #### setModifier

          public void setModifier(String modifier)

      Set the version's release modifier part.
      Parameters:
        `modifier` - modifier string

    - #### equals

          public boolean equals(Object other)

      Check if two versions are exactly equal, modifier is case insensitive.
      Overrides:
        `equals` in class `Object`
      Parameters:
        `other` - second object
      Returns:
        true if equal

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### olderThan

          public boolean olderThan(AppVersion other)

      Checks if this version is older than the specified version, according to the result of `compareTo(AppVersion)`.
      Parameters:
        `other` - other version
      Returns:
        true if this version is older than other

    - #### newerThan

          public boolean newerThan(AppVersion other)

      Checks if this version is newer than the specified version, according to the result of `compareTo(AppVersion)`.
      Parameters:
        `other` - other version
      Returns:
        true if this version is newer than other

    - #### compareTo

          public int compareTo(AppVersion other)

      Compares two version numbers according to their major, minor, patch and milestone version numbers, ordering from oldest to newest version. If all version numbers are equal, then their modifiers are compared lexicographically (based on the Unicode value of each character), ignoring case. Versions without a modifier or milestone are considered to be the "final" versions and come after other versions with a modifier or milestone.
      Specified by:
        `compareTo` in interface `Comparable<AppVersion>`
      Parameters:
        `other` -
      Returns:
        `0` if both versions are equal, a negative number if this version is older than `other`, or a positive number otherwise.

    - #### parse

          public static AppVersion parse(String versionString)

      Parses a version string into a Version object.
      Parameters:
        `versionString` - A version string, e.g. 1.0.1 or 1.0-beta1.
      Returns:
        The parsed Version.
      Throws:
        `NumberFormatException` - If versionString could not be parsed to a version.

    - #### toString

          public String toString()

      Returns the string represention of this version.
      Overrides:
        `toString` in class `Object`

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.