public class SemanticVersion extends java.lang.Object implements java.lang.Comparable<SemanticVersion>
| Modifier and Type | Field and Description |
|---|---|
int |
major
The major version
|
int |
minor
The minor version
|
int |
patch
The patch version
|
@NotNull java.lang.String |
version
The version string
|
| Constructor and Description |
|---|
SemanticVersion(@Nullable java.lang.Integer major,
@Nullable java.lang.Integer minor,
@Nullable java.lang.Integer patch)
Creates a new
SemanticVersion |
SemanticVersion(@NotNull java.lang.String version)
Creates a new
SemanticVersion, removing all non-numeric characters from the version string |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(@Nullable java.lang.Integer major,
@Nullable java.lang.Integer minor,
@Nullable java.lang.Integer patch)
Compares the version to the provided version
|
int |
compareTo(@NotNull SemanticVersion other) |
boolean |
equals(@Nullable java.lang.Object other) |
int |
hashCode() |
boolean |
isGreaterThan(@Nullable java.lang.Integer major,
@Nullable java.lang.Integer minor,
@Nullable java.lang.Integer patch)
Checks if the version is greater than the provided version
|
boolean |
isGreaterThan(@NotNull SemanticVersion other)
Checks if the version is greater than the provided version
|
boolean |
isGreaterThanOrEqualTo(@Nullable java.lang.Integer major,
@Nullable java.lang.Integer minor,
@Nullable java.lang.Integer patch)
Checks if the version is greater or equal than the provided version
|
boolean |
isGreaterThanOrEqualTo(@NotNull SemanticVersion other)
Checks if the version is greater or equal than the provided version
|
boolean |
isLessThan(@Nullable java.lang.Integer major,
@Nullable java.lang.Integer minor,
@Nullable java.lang.Integer patch)
Checks if the version is less than the provided version
|
boolean |
isLessThan(@NotNull SemanticVersion other)
Checks if the version is less than the provided version
|
boolean |
isLessThanOrEqualTo(@Nullable java.lang.Integer major,
@Nullable java.lang.Integer minor,
@Nullable java.lang.Integer patch)
Checks if the version is less or equal than the provided version
|
boolean |
isLessThanOrEqualTo(@NotNull SemanticVersion other)
Checks if the version is less or equal than the provided version
|
java.lang.String |
toString() |
@NotNull public final @NotNull java.lang.String version
public final int major
public final int minor
public final int patch
public SemanticVersion(@Nullable
@Nullable java.lang.Integer major,
@Nullable
@Nullable java.lang.Integer minor,
@Nullable
@Nullable java.lang.Integer patch)
SemanticVersionpublic SemanticVersion(@NotNull
@NotNull java.lang.String version)
SemanticVersion, removing all non-numeric characters from the version stringversion - versionpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(@Nullable
@Nullable java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(@NotNull
@NotNull SemanticVersion other)
compareTo in interface java.lang.Comparable<SemanticVersion>public int compareTo(@Nullable
@Nullable java.lang.Integer major,
@Nullable
@Nullable java.lang.Integer minor,
@Nullable
@Nullable java.lang.Integer patch)
major - the major versionminor - the minor versionpatch - the patch versionpublic boolean isGreaterThan(@NotNull
@NotNull SemanticVersion other)
other - the other versiontrue if the version is greater than the provided version, otherwise falsepublic boolean isGreaterThan(@Nullable
@Nullable java.lang.Integer major,
@Nullable
@Nullable java.lang.Integer minor,
@Nullable
@Nullable java.lang.Integer patch)
major - the major versionminor - the minor versionpatch - the patch versiontrue if the version is greater than the provided version, otherwise falsepublic boolean isGreaterThanOrEqualTo(@NotNull
@NotNull SemanticVersion other)
other - the other versiontrue if the version is greater or equal than the provided version, otherwise falsepublic boolean isGreaterThanOrEqualTo(@Nullable
@Nullable java.lang.Integer major,
@Nullable
@Nullable java.lang.Integer minor,
@Nullable
@Nullable java.lang.Integer patch)
major - the major versionminor - the minor versionpatch - the patch versiontrue if the version is greater or equal than the provided version, otherwise falsepublic boolean isLessThan(@NotNull
@NotNull SemanticVersion other)
other - the other versiontrue if the version is less than the provided version, otherwise falsepublic boolean isLessThan(@Nullable
@Nullable java.lang.Integer major,
@Nullable
@Nullable java.lang.Integer minor,
@Nullable
@Nullable java.lang.Integer patch)
major - the major versionminor - the minor versionpatch - the patch versiontrue if the version is less than the provided version, otherwise falsepublic boolean isLessThanOrEqualTo(@NotNull
@NotNull SemanticVersion other)
other - the other versiontrue if the version is less or equal than the provided version, otherwise falsepublic boolean isLessThanOrEqualTo(@Nullable
@Nullable java.lang.Integer major,
@Nullable
@Nullable java.lang.Integer minor,
@Nullable
@Nullable java.lang.Integer patch)
major - the major versionminor - the minor versionpatch - the patch versiontrue if the version is less or equal than the provided version, otherwise false