Package ca.solostudios.strata
Class Versions
- java.lang.Object
-
- ca.solostudios.strata.Versions
-
public final class Versions extends java.lang.ObjectHelper class for constructingVersionandVersionRangeliterals.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @NotNull VersiongetVersion(int major, int minor, int patch)Constructs a new version from the provided values.static @NotNull VersiongetVersion(@NotNull java.math.BigInteger major, @NotNull java.math.BigInteger minor, @NotNull java.math.BigInteger patch)Constructs a new version from the provided values.static @NotNull VersiongetVersion(@NotNull java.math.BigInteger major, @NotNull java.math.BigInteger minor, @NotNull java.math.BigInteger patch, @NotNull BuildMetadata buildMetadata)Constructs a new version from the provided values.static @NotNull VersiongetVersion(@NotNull java.math.BigInteger major, @NotNull java.math.BigInteger minor, @NotNull java.math.BigInteger patch, @NotNull PreRelease preRelease)Constructs a new version from the provided values.static @NotNull VersiongetVersion(@NotNull java.math.BigInteger major, @NotNull java.math.BigInteger minor, @NotNull java.math.BigInteger patch, @NotNull PreRelease preRelease, @NotNull BuildMetadata buildMetadata)Constructs a new version from the provided values.static @NotNull VersionRangegetVersionRange(@Nullable Version startVersion, boolean startInclusive, @Nullable Version endVersion, boolean endInclusive)Constructs a new version range from the provided values.static @NotNull VersionparseVersion(@NotNull java.lang.String versionString)Parses a version from the provided string, according to the semver spec as listed inVersionParserstatic @NotNull VersionparseVersion(@NotNull java.lang.String coreVersion, @Nullable java.lang.String preReleaseVersion, @Nullable java.lang.String buildMetadataVersion)Parses a version from the providedcoreVersion,preReleaseVersion, andbuildMetadataVersion, according to the semver spec as listed inVersionParser.static @NotNull VersionRangeparseVersionRange(@NotNull java.lang.String versionString)Parses aVersionRangefrom the provided string, according to the specification described inVersionRangeParser.
-
-
-
Method Detail
-
getVersion
@NotNull @Contract(value="_, _, _ -> new", pure=true) public static @NotNull Version getVersion(int major, int minor, int patch)Constructs a new version from the provided values.- Parameters:
major- The major version.minor- The minor version.patch- The patch version.- Returns:
- The new version.
-
getVersion
@NotNull @Contract(value="_, _, _ -> new", pure=true) public static @NotNull Version getVersion(@NotNull @NotNull java.math.BigInteger major, @NotNull @NotNull java.math.BigInteger minor, @NotNull @NotNull java.math.BigInteger patch)Constructs a new version from the provided values.- Parameters:
major- The major version.minor- The minor version.patch- The patch version.- Returns:
- The new version.
-
getVersion
@NotNull @Contract(value="_, _, _, _ -> new", pure=true) public static @NotNull Version getVersion(@NotNull @NotNull java.math.BigInteger major, @NotNull @NotNull java.math.BigInteger minor, @NotNull @NotNull java.math.BigInteger patch, @NotNull @NotNull PreRelease preRelease)Constructs a new version from the provided values.- Parameters:
major- The major version.minor- The minor version.patch- The patch version.preRelease- The pre-release version.- Returns:
- The new version.
-
getVersion
@NotNull @Contract(value="_, _, _, _ -> new", pure=true) public static @NotNull Version getVersion(@NotNull @NotNull java.math.BigInteger major, @NotNull @NotNull java.math.BigInteger minor, @NotNull @NotNull java.math.BigInteger patch, @NotNull @NotNull BuildMetadata buildMetadata)Constructs a new version from the provided values.- Parameters:
major- The major version.minor- The minor version.patch- The patch version.buildMetadata- The build metadata.- Returns:
- The new version.
-
getVersion
@NotNull @Contract(value="_, _, _, _, _ -> new", pure=true) public static @NotNull Version getVersion(@NotNull @NotNull java.math.BigInteger major, @NotNull @NotNull java.math.BigInteger minor, @NotNull @NotNull java.math.BigInteger patch, @NotNull @NotNull PreRelease preRelease, @NotNull @NotNull BuildMetadata buildMetadata)Constructs a new version from the provided values.- Parameters:
major- The major version.minor- The minor version.patch- The patch version.preRelease- The pre-release version.buildMetadata- The build metadata.- Returns:
- The new version.
-
parseVersion
@NotNull @Contract(value="_ -> new", pure=true) public static @NotNull Version parseVersion(@NotNull @NotNull java.lang.String versionString) throws ParseExceptionParses a version from the provided string, according to the semver spec as listed inVersionParser- Parameters:
versionString- The version string to parse.- Returns:
- The parsed version.
- Throws:
ParseException- If an exception occurred during the parsing of the version. If taking user input, the message from this exception is highly useful and should be returned to the user.@see Versions#parseVersion(String)- See Also:
VersionParser
-
parseVersion
@NotNull @Contract(value="_, _, _ -> new", pure=true) public static @NotNull Version parseVersion(@NotNull @NotNull java.lang.String coreVersion, @Nullable @Nullable java.lang.String preReleaseVersion, @Nullable @Nullable java.lang.String buildMetadataVersion) throws ParseExceptionParses a version from the providedcoreVersion,preReleaseVersion, andbuildMetadataVersion, according to the semver spec as listed inVersionParser.- Parameters:
coreVersion- The core version.preReleaseVersion- The pre-release version.buildMetadataVersion- The build metadata.- Returns:
- The parsed version.
- Throws:
ParseException- If an exception occurred during the parsing of the version. If taking user input, the message from this exception is highly useful and should be returned to the user.@see Versions#parseVersion(String)- See Also:
VersionParser
-
parseVersionRange
@NotNull @Contract(value="_ -> new", pure=true) public static @NotNull VersionRange parseVersionRange(@NotNull @NotNull java.lang.String versionString) throws ParseExceptionParses aVersionRangefrom the provided string, according to the specification described inVersionRangeParser.- Parameters:
versionString- The version range string to parse.- Returns:
- The parsed version range.
- Throws:
ParseException- If an exception occurred during the parsing of the version. If taking user input, the message from this exception is highly useful and should be returned to the user.@see Versions#parseVersion(String)- See Also:
VersionRangeParser
-
getVersionRange
@NotNull @Contract(value="_, _, _, _ -> new", pure=true) public static @NotNull VersionRange getVersionRange(@Nullable @Nullable Version startVersion, boolean startInclusive, @Nullable @Nullable Version endVersion, boolean endInclusive)Constructs a new version range from the provided values.- Parameters:
startVersion- The starting version. Usenullif this has no lower bound.startInclusive-trueif the starting version is inclusive,falseif the starting version is exclusive.endVersion- The ending version. Usenullif this has no upper bound.endInclusive-trueif the ending version is inclusive,falseif the ending version is exclusive.- Returns:
- The version range from the provided values.
- See Also:
VersionRange(ca.solostudios.strata.version.Version, boolean, ca.solostudios.strata.version.Version, boolean)
-
-