Package org.agrona

Class SemanticVersion

java.lang.Object
org.agrona.SemanticVersion

public final class SemanticVersion extends Object
Store and extract a semantic version in a 4 byte integer.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    compose(int major, int minor, int patch)
    Compose a 4-byte integer with major, minor, and patch version stored in the least significant 3 bytes.
    static int
    major(int version)
    Get the major version from a composite value.
    static int
    minor(int version)
    Get the minor version from a composite value.
    static int
    patch(int version)
    Get the patch version from a composite value.
    static String
    toString(int version)
    Generate a String representation of the semantic version in the format major.minor.patch.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SemanticVersion

      private SemanticVersion()
  • Method Details

    • compose

      public static int compose(int major, int minor, int patch)
      Compose a 4-byte integer with major, minor, and patch version stored in the least significant 3 bytes. The sum of the components must be greater than zero.
      Parameters:
      major - version in the range 0-255.
      minor - version in the range 0-255
      patch - version in the range 0-255.
      Returns:
      the semantic version made from the three components.
      Throws:
      IllegalArgumentException - if the values are outside acceptable range.
    • major

      public static int major(int version)
      Get the major version from a composite value.
      Parameters:
      version - as a composite from which to extract the major version.
      Returns:
      the major version value.
    • minor

      public static int minor(int version)
      Get the minor version from a composite value.
      Parameters:
      version - as a composite from which to extract the minor version.
      Returns:
      the minor version value.
    • patch

      public static int patch(int version)
      Get the patch version from a composite value.
      Parameters:
      version - as a composite from which to extract the patch version.
      Returns:
      the patch version value.
    • toString

      public static String toString(int version)
      Generate a String representation of the semantic version in the format major.minor.patch.
      Parameters:
      version - to be converted to a string.
      Returns:
      the String representation of the semantic version in the format major.minor.patch.