java.lang.Object
dev.qilletni.api.lib.qll.Version
dev.qilletni.api.lib.qll.ComparableVersion
- All Implemented Interfaces:
Comparable<ComparableVersion>
A
Version that may be compared with others, fitting a range.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSpecifies how a version may be matched with other versions. -
Constructor Summary
ConstructorsConstructorDescriptionComparableVersion(int major, int minor, int patch, ComparableVersion.RangeSpecifier rangeSpecifier) Creates a newComparableVersionwith the given major, minor, and patch versions, and a range specifier.ComparableVersion(Version version, ComparableVersion.RangeSpecifier rangeSpecifier) Creates a newComparableVersionwith the givenVersionand range specifier. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ComparableVersion other) Comparable method to allow comparison between versions using java Comparablesstatic Optional<ComparableVersion> parseComparableVersionString(String versionString) Parses aComparableVersionfrom a string, such as^1.0.0.booleanpermitsVersion(Version checkVersion) Checks if the currentComparableVersionpermits the givenVersionto be used in the current range.toString()Methods inherited from class dev.qilletni.api.lib.qll.Version
equals, getVersionString, hashCode, major, minor, parseVersionString, patch
-
Constructor Details
-
ComparableVersion
public ComparableVersion(int major, int minor, int patch, ComparableVersion.RangeSpecifier rangeSpecifier) Creates a newComparableVersionwith the given major, minor, and patch versions, and a range specifier.- Parameters:
major- The major versionminor- The minor versionpatch- The patch versionrangeSpecifier- The range specifier for the version
-
ComparableVersion
Creates a newComparableVersionwith the givenVersionand range specifier.- Parameters:
version- The version to use, specifying the major, minor, and patch versionsrangeSpecifier- The range specifier for the version
-
-
Method Details
-
parseComparableVersionString
Parses aComparableVersionfrom a string, such as^1.0.0. If the version doesn't contain a range specifier, thenComparableVersion.RangeSpecifier.EXACTis set.- Parameters:
versionString- The version string to parse- Returns:
- The created
ComparableVersion, if the string was valid
-
permitsVersion
Checks if the currentComparableVersionpermits the givenVersionto be used in the current range.- Parameters:
checkVersion- The version to compare- Returns:
- If the version fits the bounds of the current
ComparableVersion.RangeSpecifier
-
compareTo
Comparable method to allow comparison between versions using java Comparables- Specified by:
compareToin interfaceComparable<ComparableVersion>- Parameters:
other- the ComparableVersion to be compared.- Returns:
- the compare value between this version and the other ComparableVersion
-
toString
-