Package org.agrona
Class SemanticVersion
java.lang.Object
org.agrona.SemanticVersion
Store and extract a semantic version in a 4 byte integer.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcompose(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 intmajor(int version) Get the major version from a composite value.static intminor(int version) Get the minor version from a composite value.static intpatch(int version) Get the patch version from a composite value.static StringtoString(int version) Generate aStringrepresentation of the semantic version in the formatmajor.minor.patch.
-
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 aStringrepresentation of the semantic version in the formatmajor.minor.patch.- Parameters:
version- to be converted to a string.- Returns:
- the
Stringrepresentation of the semantic version in the formatmajor.minor.patch.
-