Package org.agrona
Class SemanticVersion
java.lang.Object
org.agrona.SemanticVersion
Store and extract a semantic version in a 4 byte integer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 aString
representation of the semantic version in the formatmajor.minor.patch
.
-
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-255patch
- 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
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
.
-