Package org.agrona
Class SemanticVersion
- java.lang.Object
-
- org.agrona.SemanticVersion
-
public final class SemanticVersion extends java.lang.Object
Store and extract a semantic version in a 4 byte integer.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
SemanticVersion()
-
Method Summary
All Methods Static Methods Concrete Methods 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 java.lang.String
toString(int version)
Generate aString
representation of the semantic version in the formatmajor.minor.patch
.
-
-
-
Method Detail
-
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-255patch
- version in the range 0-255.- Returns:
- the semantic version made from the three components.
- Throws:
java.lang.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 java.lang.String toString(int version)
Generate aString
representation of the semantic version in the formatmajor.minor.patch
.- Parameters:
version
- to be converted to a string.- Returns:
- the
String
representation of the semantic version in the formatmajor.minor.patch
.
-
-