public class Version extends Object implements Comparable<Version>, Serializable
The Version class is immutable and thread-safe.
| Modifier and Type | Class and Description |
|---|---|
static class |
Version.Builder
A mutable builder for the immutable
Version class |
| Modifier and Type | Field and Description |
|---|---|
static Comparator<Version> |
BUILD_AWARE_ORDER
Deprecated.
forRemoval since 0.10.0, use
compareTo(Version) |
static Comparator<Version> |
INCREMENT_ORDER
A comparator that sorts versions in increment order, from lowest to highest.
|
static Comparator<Version> |
PRECEDENCE_ORDER
A comparator that sorts versions in (highest) precedence order.
|
| Modifier and Type | Method and Description |
|---|---|
Optional<String> |
buildMetadata()
Returns this
Version's build metadata in the form of
dot-separated identifiers. |
int |
compareTo(Version other)
Compares versions, along with their build metadata.
|
int |
compareToIgnoreBuildMetadata(Version other)
Compares versions, ignoring their build metadata.
|
int |
compareWithBuildsTo(Version other)
Deprecated.
forRemoval since 0.10.0, use
compareTo(Version) |
boolean |
equals(Object other)
Checks if this
Version exactly equals the specified Version. |
static Version |
forIntegers(int major)
Deprecated.
forRemoval since 0.10.0, use
of(long) |
static Version |
forIntegers(int major,
int minor)
Deprecated.
forRemoval since 0.10.0, use
of(long, long) |
static Version |
forIntegers(int major,
int minor,
int patch)
Deprecated.
forRemoval since 0.10.0, use
of(long, long, long) |
String |
getBuildMetadata()
Deprecated.
forRemoval since 0.10.0, use
buildMetadata() |
int |
getMajorVersion()
Deprecated.
forRemoval since 0.10.0, use
majorVersion() |
int |
getMinorVersion()
Deprecated.
forRemoval since 0.10.0, use
minorVersion() |
String |
getNormalVersion()
Deprecated.
forRemoval since 0.10.0
|
int |
getPatchVersion()
Deprecated.
forRemoval since 0.10.0, use
patchVersion() |
String |
getPreReleaseVersion()
Deprecated.
forRemoval since 0.10.0, use
preReleaseVersion() |
boolean |
greaterThan(Version other)
Deprecated.
forRemoval since 0.10.0, use
isHigherThan(Version) |
boolean |
greaterThanOrEqualTo(Version other)
Deprecated.
forRemoval since 0.10.0, use
isHigherThanOrEquivalentTo(Version) |
int |
hashCode() |
Version |
incrementBuildMetadata()
Deprecated.
forRemoval since 0.10.0
|
Version |
incrementMajorVersion()
Deprecated.
forRemoval since 0.10.0, use
nextMajorVersion(String...) |
Version |
incrementMajorVersion(String preRelease)
Deprecated.
forRemoval since 0.10.0, use
nextMajorVersion(String...) |
Version |
incrementMinorVersion()
Deprecated.
forRemoval since 0.10.0, use
nextMinorVersion(String...) |
Version |
incrementMinorVersion(String preRelease)
Deprecated.
forRemoval since 0.10.0, use
nextMinorVersion(String...) |
Version |
incrementPatchVersion()
Deprecated.
forRemoval since 0.10.0, use
nextPatchVersion(String...) |
Version |
incrementPatchVersion(String preRelease)
Deprecated.
forRemoval since 0.10.0, use
nextPatchVersion(String...) |
Version |
incrementPreReleaseVersion()
Deprecated.
forRemoval since 0.10.0, use
nextPreReleaseVersion(String...) |
boolean |
isEquivalentTo(Version other)
Determines if this
Version has the same precedence as the
specified Version. |
boolean |
isHigherThan(Version other)
Determines if this
Version has a higher precedence compared with
the specified Version. |
boolean |
isHigherThanOrEquivalentTo(Version other)
Determines if this
Version has a higher or equal precedence
compared with the specified Version. |
boolean |
isLowerThan(Version other)
Determines if this
Version has a lower precedence compared with
the specified Version. |
boolean |
isLowerThanOrEquivalentTo(Version other)
Determines if this
Version has a lower or equal precedence
compared with the specified Version. |
boolean |
isPreRelease()
Checks if this
Version represents a pre-release version. |
boolean |
isPublicApiCompatibleWith(Version other)
Checks if this
Version is compatible with the specified Version
in terms of their public API. |
boolean |
isPublicApiStable()
Checks if this
Version represents a stable public API. |
boolean |
isSameMajorVersionAs(Version other)
Checks if this
Version is compatible with the specified Version
in terms of their major versions. |
boolean |
isSameMinorVersionAs(Version other)
Checks if this
Version is compatible with the specified Version
in terms of their major and minor versions. |
boolean |
isSamePatchVersionAs(Version other)
Checks if this
Version is compatible with the specified Version
in terms of their major, minor and patch versions. |
boolean |
isStable()
Checks if this
Version represents a stable version. |
static boolean |
isValid(String version)
Checks validity of the specified SemVer version string in strict mode,
which ensures full compliance with the specification.
|
static boolean |
isValid(String version,
boolean strictly)
Checks validity of the specified SemVer version string.
|
boolean |
lessThan(Version other)
Deprecated.
forRemoval since 0.10.0, use
isLowerThan(Version) |
boolean |
lessThanOrEqualTo(Version other)
Deprecated.
forRemoval since 0.10.0, use
isLowerThanOrEquivalentTo(Version) |
long |
majorVersion()
Returns this
Version's major version. |
long |
minorVersion()
Returns this
Version's minor version. |
Version |
nextMajorVersion(long major,
String... preReleaseIds)
Obtains the next
Version of the specified major version number,
with an optional pre-release version label. |
Version |
nextMajorVersion(String... preReleaseIds)
Obtains the next
Version by incrementing the major version number
by one, with an optional pre-release version label. |
Version |
nextMinorVersion(long minor,
String... preReleaseIds)
Obtains the next
Version of the specified minor version number,
with an optional pre-release version label. |
Version |
nextMinorVersion(String... preReleaseIds)
Obtains the next
Version by incrementing the minor version number
by one, with an optional pre-release version label. |
Version |
nextPatchVersion(long patch,
String... preReleaseIds)
Obtains the next
Version of the specified patch version number,
with an optional pre-release version label. |
Version |
nextPatchVersion(String... preReleaseIds)
Obtains the next
Version by incrementing the patch version number
by one, with an optional pre-release version label. |
Version |
nextPreReleaseVersion(String... ids)
Obtains the next
Version by incrementing or replacing the
pre-release version. |
static Version |
of(long major)
Obtains a
Version instance of the specified major version. |
static Version |
of(long major,
long minor)
Obtains a
Version instance of the specified major and minor versions. |
static Version |
of(long major,
long minor,
long patch)
Obtains a
Version instance of the specified major, minor and
patch versions. |
static Version |
of(long major,
long minor,
long patch,
String preRelease)
Obtains a
Version instance of the specified major, minor, patch
and pre-release versions. |
static Version |
of(long major,
long minor,
long patch,
String preRelease,
String build)
Obtains a
Version instance of the specified major, minor, patch
and pre-release versions, as well as build metadata. |
static Version |
of(long major,
long minor,
String preRelease)
Obtains a
Version instance of the specified major, minor and
pre-release versions. |
static Version |
of(long major,
long minor,
String preRelease,
String build)
Obtains a
Version instance of the specified major, minor and
pre-release versions, as well as build metadata. |
static Version |
of(long major,
String preRelease)
Obtains a
Version instance of the specified major and pre-release
versions. |
static Version |
of(long major,
String preRelease,
String build)
Obtains a
Version instance of the specified major and pre-release
versions, as well as build metadata. |
static Version |
parse(String version)
Obtains a
Version instance by parsing the specified string in
strict mode, which ensures full compliance with the specification. |
static Version |
parse(String version,
boolean strictly)
Obtains a
Version instance by parsing the specified string. |
long |
patchVersion()
Returns this
Version's patch version. |
Optional<String> |
preReleaseVersion()
Returns this
Version's pre-release version in the form of
dot-separated identifiers. |
boolean |
satisfies(Predicate<Version> predicate)
Checks if this
Version satisfies the specified predicate. |
boolean |
satisfies(String expr)
Checks if this
Version satisfies the specified range expression. |
Version |
setBuildMetadata(String build)
Deprecated.
forRemoval since 0.10.0, use
withBuildMetadata(String...) |
Version |
setPreReleaseVersion(String preRelease)
Deprecated.
forRemoval since 0.10.0, consider using
nextPreReleaseVersion(String...) |
Version.Builder |
toBuilder()
Converts this
Version to Builder. |
Version |
toStableVersion()
Obtains the next
Version by dropping the pre-release version. |
String |
toString() |
static Optional<Version> |
tryParse(String version)
Tries to obtain a
Version instance by parsing the specified string
in strict mode, which ensures full compliance with the specification. |
static Optional<Version> |
tryParse(String version,
boolean strictly)
Tries to obtain a
Version instance by parsing the specified string. |
static Version |
valueOf(String version)
Deprecated.
forRemoval since 0.10.0, use
parse(String) |
Version |
withBuildMetadata(String... ids)
Obtains a new
Version with the specified build identifiers. |
Version |
withoutBuildMetadata()
Obtains a (new)
Version without build metadata. |
public static final Comparator<Version> INCREMENT_ORDER
The comparator is intended for use in comparison-based data structures.
compareToIgnoreBuildMetadata(Version)public static final Comparator<Version> PRECEDENCE_ORDER
The ordering imposed by this comparator is reverse of the "natural" increment ordering, that is, versions are arranged in descending order from highest-precedence to lowest-precedence.
The comparator is intended for use in comparison-based data structures.
INCREMENT_ORDER@Deprecated public static final Comparator<Version> BUILD_AWARE_ORDER
compareTo(Version)public static Version parse(String version)
Version instance by parsing the specified string in
strict mode, which ensures full compliance with the specification.version - a string representing a SemVer version, non-nullVersion instanceIllegalArgumentException - if version is nullParseException - if version can't be parsedparse(String, boolean)public static Version parse(String version, boolean strictly)
Version instance by parsing the specified string.
This method provides a way to parse the specified string in lenient mode, which accepts shorter version cores, such as "1" or "1.2".
version - a string representing a SemVer version, non-nullstrictly - whether to parse the specified string in strict modeVersion instanceIllegalArgumentException - if version is nullParseException - if version can't be parsedparse(String)public static Optional<Version> tryParse(String version)
Version instance by parsing the specified string
in strict mode, which ensures full compliance with the specification.version - a string representing a SemVer version, nullableOptional with a Version instance, if the
specified string can be parsed; empty Optional otherwisetryParse(String, boolean)public static Optional<Version> tryParse(String version, boolean strictly)
Version instance by parsing the specified string.
This method provides a way to parse the specified string in lenient mode, which accepts shorter version cores, such as "1" or "1.2".
version - a string representing a SemVer version, nullablestrictly - whether to parse the specified string in strict modeOptional with a Version instance, if the
specified string can be parsed; empty Optional otherwisetryParse(String)public static boolean isValid(String version)
Note that internally this method makes use of parse(String) and
suppresses any exceptions, so using it to avoid dealing with exceptions
like so:
String version = "1.2.3";
if (Version.isValid(version)) {
Version v = Version.parse(version);
}
would mean parsing the same version string twice. In this case, as an
alternative, consider using tryParse(String).version - a string representing a SemVer version, nullabletrue, if the specified string is a valid SemVer version;
false otherwiseisValid(String, boolean)public static boolean isValid(String version, boolean strictly)
This method provides a way to parse the specified string in lenient mode, which accepts shorter version cores, such as "1" or "1.2".
version - a string representing a SemVer version, nullablestrictly - whether to parse the specified string in strict modetrue, if the specified string is a valid SemVer version;
false otherwiseisValid(String)public static Version of(long major)
Version instance of the specified major version.major - a major version number, non-negativeVersion instanceIllegalArgumentException - if major is negativepublic static Version of(long major, String preRelease)
Version instance of the specified major and pre-release
versions.major - a major version number, non-negativepreRelease - a pre-release version label, nullableVersion instanceIllegalArgumentException - if major is negativeParseException - if preRelease can't be parsedpublic static Version of(long major, String preRelease, String build)
Version instance of the specified major and pre-release
versions, as well as build metadata.major - a major version number, non-negativepreRelease - a pre-release version label, nullablebuild - a build metadata label, nullableVersion instanceIllegalArgumentException - if major is negativeParseException - if preRelease or build can't be parsedpublic static Version of(long major, long minor)
Version instance of the specified major and minor versions.major - a major version number, non-negativeminor - a minor version number, non-negativeVersion instanceIllegalArgumentException - if major or minor is negativepublic static Version of(long major, long minor, String preRelease)
Version instance of the specified major, minor and
pre-release versions.major - a major version number, non-negativeminor - a minor version number, non-negativepreRelease - a pre-release version label, nullableVersion instanceIllegalArgumentException - if major or minor is negativeParseException - if preRelease can't be parsedpublic static Version of(long major, long minor, String preRelease, String build)
Version instance of the specified major, minor and
pre-release versions, as well as build metadata.major - a major version number, non-negativeminor - a minor version number, non-negativepreRelease - a pre-release version label, nullablebuild - a build metadata label, nullableVersion instanceIllegalArgumentException - if major or minor is negativeParseException - if preRelease or build can't be parsedpublic static Version of(long major, long minor, long patch)
Version instance of the specified major, minor and
patch versions.major - a major version number, non-negativeminor - a minor version number, non-negativepatch - a patch version number, non-negativeVersion instanceIllegalArgumentException - if any of the arguments is negativepublic static Version of(long major, long minor, long patch, String preRelease)
Version instance of the specified major, minor, patch
and pre-release versions.major - a major version number, non-negativeminor - a minor version number, non-negativepatch - a patch version number, non-negativepreRelease - a pre-release version label, nullableVersion instanceIllegalArgumentException - if any of the numeric arguments is negativeParseException - if preRelease can't be parsedpublic static Version of(long major, long minor, long patch, String preRelease, String build)
Version instance of the specified major, minor, patch
and pre-release versions, as well as build metadata.major - a major version number, non-negativeminor - a minor version number, non-negativepatch - a patch version number, non-negativepreRelease - a pre-release version label, nullablebuild - a build metadata label, nullableVersion instanceIllegalArgumentException - if any of the numeric arguments is negativeParseException - if preRelease or build can't be parsedpublic long majorVersion()
Version's major version.public long minorVersion()
Version's minor version.public long patchVersion()
Version's patch version.public Optional<String> preReleaseVersion()
Version's pre-release version in the form of
dot-separated identifiers.public Optional<String> buildMetadata()
Version's build metadata in the form of
dot-separated identifiers.public Version nextMajorVersion(String... preReleaseIds)
Version by incrementing the major version number
by one, with an optional pre-release version label.
Multiple identifiers can be specified in a single argument joined with dots, or in separate arguments, or both.
This method drops the build metadata, if present.
preReleaseIds - zero or more pre-release identifiers, non-nullVersion instanceArithmeticException - if the major version number overflowsIllegalArgumentException - if preReleaseIds is null or contains nullParseException - if any of the specified identifiers can't be parsedpublic Version nextMajorVersion(long major, String... preReleaseIds)
Version of the specified major version number,
with an optional pre-release version label.
The specified major version number must be higher than this Version's
major version.
Multiple identifiers can be specified in a single argument joined with dots, or in separate arguments, or both.
This method drops the build metadata, if present.
major - the next major version number, non-negativepreReleaseIds - zero or more pre-release identifiers, non-nullVersion instanceIllegalArgumentException - if major is negative, or if
preReleaseIds is null or contains nullIllegalStateException - if major is lower than or equivalent
to this Version's major versionParseException - if any of the specified identifiers can't be parsedpublic Version nextMinorVersion(String... preReleaseIds)
Version by incrementing the minor version number
by one, with an optional pre-release version label.
Multiple identifiers can be specified in a single argument joined with dots, or in separate arguments, or both.
This method drops the build metadata, if present.
preReleaseIds - zero or more pre-release identifiers, non-nullVersion instanceArithmeticException - if the minor version number overflowsIllegalArgumentException - if preReleaseIds is null or contains nullParseException - if any of the specified identifiers can't be parsedpublic Version nextMinorVersion(long minor, String... preReleaseIds)
Version of the specified minor version number,
with an optional pre-release version label.
The specified minor version number must be higher than this Version's
minor version.
Multiple identifiers can be specified in a single argument joined with dots, or in separate arguments, or both.
This method drops the build metadata, if present.
minor - the next minor version number, non-negativepreReleaseIds - zero or more pre-release identifiers, non-nullVersion instanceIllegalArgumentException - if minor is negative, or if
preReleaseIds is null or contains nullIllegalStateException - if minor is lower than or equivalent
to this Version's minor versionParseException - if any of the specified identifiers can't be parsedpublic Version nextPatchVersion(String... preReleaseIds)
Version by incrementing the patch version number
by one, with an optional pre-release version label.
Multiple identifiers can be specified in a single argument joined with dots, or in separate arguments, or both.
This method drops the build metadata, if present.
preReleaseIds - zero or more pre-release identifiers, non-nullVersion instanceArithmeticException - if the patch version number overflowsIllegalArgumentException - if preReleaseIds is null or contains nullParseException - if any of the specified identifiers can't be parsedpublic Version nextPatchVersion(long patch, String... preReleaseIds)
Version of the specified patch version number,
with an optional pre-release version label.
The specified patch version number must be higher than this Version's
patch version.
Multiple identifiers can be specified in a single argument joined with dots, or in separate arguments, or both.
This method drops the build metadata, if present.
patch - the next patch version number, non-negativepreReleaseIds - zero or more pre-release identifiers, non-nullVersion instanceIllegalArgumentException - if patch is negative, or if
preReleaseIds is null or contains nullIllegalStateException - if patch is lower than or equivalent
to this Version's patch versionParseException - if any of the specified identifiers can't be parsedpublic Version nextPreReleaseVersion(String... ids)
Version by incrementing or replacing the
pre-release version.
If no pre-release identifiers are specified, the current pre-release
version's last numeric identifier is incremented. If the current
pre-release version's last identifier is not numeric, a new numeric
identifier of value "0" is appended for this operation. If specified,
however, the pre-release identifiers replace the current pre-release
version. The new pre-release version must be higher than this
Version's pre-release version.
Multiple identifiers can be specified in a single argument joined with dots, or in separate arguments, or both.
This method drops the build metadata, if present.
ids - zero or more pre-release identifiers, non-nullVersion instanceArithmeticException - if the incremented numeric identifier overflowsIllegalArgumentException - if ids is null or contains nullIllegalStateException - if invoked on a stable Version, or
if the specified pre-release version is lower than or equivalent
to this Version's pre-release versionParseException - if any of the specified identifiers can't be parsedpublic Version toStableVersion()
Version by dropping the pre-release version.
This method drops the build metadata, if present.
Version instancepublic Version withBuildMetadata(String... ids)
Version with the specified build identifiers.
Multiple identifiers can be specified in a single argument joined with dots, or in separate arguments, or both.
ids - one or more build identifiers, non-nullVersion instanceIllegalArgumentException - if ids is null/empty or contains nullParseException - if any of the specified identifiers can't be parsedpublic Version withoutBuildMetadata()
Version without build metadata.Version instancepublic boolean satisfies(Predicate<Version> predicate)
Version satisfies the specified predicate.predicate - a predicate to test, non-nulltrue, if this Version satisfies the predicate;
false otherwiseIllegalArgumentException - if predicate is nullpublic boolean satisfies(String expr)
Version satisfies the specified range expression.expr - a SemVer Expression string, non-nulltrue, if this Version satisfies the specified
expression; false otherwiseIllegalArgumentException - if expr is nullParseException - if expr can't be parsedpublic boolean isPreRelease()
Version represents a pre-release version.
This method is opposite of isStable().
true, if this Version represents a pre-release
version; false otherwiseisStable()public boolean isStable()
Version represents a stable version.
Pre-release versions are considered unstable. (SemVer p.9)
true, if this Version represents a stable
version; false otherwiseisPreRelease()public boolean isPublicApiStable()
Version represents a stable public API.
Versions lower than 1.0.0 are for initial development, therefore the public API should not be considered stable. (SemVer p.4)
true, if this Version represents a stable public
API; false otherwisepublic boolean isPublicApiCompatibleWith(Version other)
Version is compatible with the specified Version
in terms of their public API.
Two versions are compatible in terms of public API iff they have the same major version of 1 or higher. Being public API compatible doesn't necessarily mean both versions have the same set of public API units. It only means that the versions are interchangeable.
other - the Version to compare with, non-nulltrue, if the versions are compatible in terms of public API;
false otherwiseIllegalArgumentException - if other is nullpublic boolean isSameMajorVersionAs(Version other)
Version is compatible with the specified Version
in terms of their major versions.other - the Version to compare with, non-nulltrue, if both versions have the same major version;
false otherwiseIllegalArgumentException - if other is nullpublic boolean isSameMinorVersionAs(Version other)
Version is compatible with the specified Version
in terms of their major and minor versions.other - the Version to compare with, non-nulltrue, if both versions have the same major and minor versions;
false otherwiseIllegalArgumentException - if other is nullpublic boolean isSamePatchVersionAs(Version other)
Version is compatible with the specified Version
in terms of their major, minor and patch versions.other - the Version to compare with, non-nulltrue, if both versions have the same major, minor and patch
versions; false otherwiseIllegalArgumentException - if other is nullpublic boolean isHigherThan(Version other)
Version has a higher precedence compared with
the specified Version.other - the Version to compare with, non-nulltrue, if this Version is higher than the other
Version; false otherwiseIllegalArgumentException - if other is nullcompareToIgnoreBuildMetadata(Version)public boolean isHigherThanOrEquivalentTo(Version other)
Version has a higher or equal precedence
compared with the specified Version.other - the Version to compare with, non-nulltrue, if this Version is higher than or equivalent
to the other Version; false otherwiseIllegalArgumentException - if other is nullcompareToIgnoreBuildMetadata(Version)public boolean isLowerThan(Version other)
Version has a lower precedence compared with
the specified Version.other - the Version to compare with, non-nulltrue, if this Version is lower than the other
Version; false otherwiseIllegalArgumentException - if other is nullcompareToIgnoreBuildMetadata(Version)public boolean isLowerThanOrEquivalentTo(Version other)
Version has a lower or equal precedence
compared with the specified Version.other - the Version to compare with, non-nulltrue, if this Version is lower than or equivalent
to the other Version; false otherwiseIllegalArgumentException - if other is nullcompareToIgnoreBuildMetadata(Version)public boolean isEquivalentTo(Version other)
Version has the same precedence as the
specified Version.
As per SemVer p.10, build metadata is ignored when determining version
precedence. To test for exact equality, including build metadata, use
equals(Object).
other - the Version to compare with, non-nulltrue, if this Version is equivalent to the other
Version; false otherwiseIllegalArgumentException - if other is nullcompareToIgnoreBuildMetadata(Version)public int compareTo(Version other)
Note that this method violates the SemVer p.10 ("build metadata must be
ignored") rule, hence can't be used for determining version precedence.
It was made so intentionally for it to be consistent with equals
as defined by Comparable, and to be used in comparison-based data
structures.
As the Specification defines no comparison rules for build metadata, this behavior is strictly implementation-defined. Build metadata are compared similarly to pre-release versions. A version with build metadata is ordered after an equivalent one without it.
To compare Versions without their build metadata in order to determine
precedence use compareToIgnoreBuildMetadata(Version).
compareTo in interface Comparable<Version>other - the Version to compare with, non-nullVersion is less than, equal to or greater than the
specified VersionIllegalArgumentException - if other is nullpublic int compareToIgnoreBuildMetadata(Version other)
This method adheres to the comparison rules defined by the Specification,
and as such can be used for determining version precedence, either as a
natural-order comparator (Version::compareToIgnoreBuildMetadata),
or as a regular method.
other - the Version to compare with, non-nullVersion is lower than, equivalent to or higher than the
specified VersionIllegalArgumentException - if other is nullpublic boolean equals(Object other)
Version exactly equals the specified Version.
Although primarily intended for use in hash-based data structures, it
can be used for testing for exact equality, including build metadata, if
needed. To test for equivalence use isEquivalentTo(Version).
public Version.Builder toBuilder()
Version to Builder.
This method allows to use an instance of Version as a template
for new instances.
Builder instance populated with values from
this Version@Deprecated public static Version valueOf(String version)
parse(String)version - a string representing a SemVer version, non-nullVersion instanceIllegalArgumentException - if version is nullParseException - if version can't be parsed@Deprecated public static Version forIntegers(int major)
of(long)major - a major version number, non-negativeVersion instanceIllegalArgumentException - if major is negative@Deprecated public static Version forIntegers(int major, int minor)
of(long, long)major - a major version number, non-negativeminor - a minor version number, non-negativeVersion instanceIllegalArgumentException - if major or minor is negative@Deprecated public static Version forIntegers(int major, int minor, int patch)
of(long, long, long)major - a major version number, non-negativeminor - a minor version number, non-negativepatch - a patch version number, non-negativeVersion instanceIllegalArgumentException - if any of the arguments is negative@Deprecated public String getNormalVersion()
Version@Deprecated public int getMajorVersion()
majorVersion()@Deprecated public int getMinorVersion()
minorVersion()@Deprecated public int getPatchVersion()
patchVersion()@Deprecated public String getPreReleaseVersion()
preReleaseVersion()@Deprecated public String getBuildMetadata()
buildMetadata()@Deprecated public Version setPreReleaseVersion(String preRelease)
nextPreReleaseVersion(String...)preRelease - the pre-release version label, non-nullVersion instanceIllegalArgumentException - if preRelease is nullParseException - if preRelease can't be parsed@Deprecated public Version setBuildMetadata(String build)
withBuildMetadata(String...)build - the build metadata label, non-nullVersion instanceIllegalArgumentException - if build is nullParseException - if build can't be parsed@Deprecated public Version incrementMajorVersion()
nextMajorVersion(String...)Version instanceArithmeticException - if the major version number overflows@Deprecated public Version incrementMajorVersion(String preRelease)
nextMajorVersion(String...)preRelease - the pre-release version label, non-nullVersion instanceArithmeticException - if the major version number overflowsIllegalArgumentException - if preRelease is nullParseException - if preRelease can't be parsed@Deprecated public Version incrementMinorVersion()
nextMinorVersion(String...)Version instanceArithmeticException - if the minor version number overflows@Deprecated public Version incrementMinorVersion(String preRelease)
nextMinorVersion(String...)preRelease - the pre-release version label, non-nullVersion instanceArithmeticException - if the minor version number overflowsIllegalArgumentException - if preRelease is nullParseException - if preRelease can't be parsed@Deprecated public Version incrementPatchVersion()
nextPatchVersion(String...)Version instanceArithmeticException - if the patch version number overflows@Deprecated public Version incrementPatchVersion(String preRelease)
nextPatchVersion(String...)preRelease - the pre-release version label, non-nullVersion instanceArithmeticException - if the patch version number overflowsIllegalArgumentException - if preRelease is nullParseException - if preRelease can't be parsed@Deprecated public Version incrementPreReleaseVersion()
nextPreReleaseVersion(String...)Version instanceArithmeticException - if the incremented numeric identifier overflowsIllegalStateException - if invoked on a stable Version@Deprecated public Version incrementBuildMetadata()
Version instanceIllegalStateException - if this Version doesn't have build metadata@Deprecated public boolean greaterThan(Version other)
isHigherThan(Version)other - the Version to compare with, non-nulltrue, if this Version is higher than the other
Version; false otherwiseIllegalArgumentException - if other is null@Deprecated public boolean greaterThanOrEqualTo(Version other)
isHigherThanOrEquivalentTo(Version)other - the Version to compare with, non-nulltrue, if this Version is higher than or equivalent
to the other Version; false otherwiseIllegalArgumentException - if other is null@Deprecated public boolean lessThan(Version other)
isLowerThan(Version)other - the Version to compare with, non-nulltrue, if this Version is lower than the other
Version; false otherwiseIllegalArgumentException - if other is null@Deprecated public boolean lessThanOrEqualTo(Version other)
isLowerThanOrEquivalentTo(Version)other - the Version to compare with, non-nulltrue, if this Version is lower than or equivalent
to the other Version; false otherwiseIllegalArgumentException - if other is null@Deprecated public int compareWithBuildsTo(Version other)
compareTo(Version)other - the Version to compare with, non-nullVersion is less than, equal to or greater than the
specified VersionIllegalArgumentException - if other is nullCopyright © 2024. All rights reserved.