public class Semver extends Object implements Comparable<Semver>
| Modifier and Type | Class and Description |
|---|---|
static class |
Semver.SemverType
The different types of supported version systems.
|
static class |
Semver.VersionDiff
The types of diffs between two versions.
|
| Constructor and Description |
|---|
Semver(String value) |
Semver(String value,
Semver.SemverType type) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Semver version) |
Semver.VersionDiff |
diff(Semver version)
Returns the greatest difference between 2 versions.
|
Semver.VersionDiff |
diff(String version) |
boolean |
equals(Object o) |
String |
getBuild()
Returns the build of the version.
|
Integer |
getMajor()
Returns the major part of the version.
|
Integer |
getMinor()
Returns the minor part of the version.
|
String |
getOriginalValue()
Get the original value as a string
|
Integer |
getPatch()
Returns the patch part of the version.
|
String[] |
getSuffixTokens()
Returns the suffix of the version.
|
Semver.SemverType |
getType() |
String |
getValue()
Returns the version as a String
|
int |
hashCode() |
boolean |
isEqualTo(Semver version)
Checks if the version equals another version
|
boolean |
isEqualTo(String version) |
boolean |
isEquivalentTo(Semver version)
Checks if the version equals another version, without taking the build into account.
|
boolean |
isEquivalentTo(String version) |
boolean |
isGreaterThan(Semver version)
Checks if the version is greater than another version
|
boolean |
isGreaterThan(String version) |
boolean |
isGreaterThanOrEqualTo(Semver version)
Checks if the version is greater than or equal to another version
|
boolean |
isGreaterThanOrEqualTo(String version) |
boolean |
isLowerThan(Semver version)
Checks if the version is lower than another version
|
boolean |
isLowerThan(String version) |
boolean |
isLowerThanOrEqualTo(Semver version)
Checks if the version is lower than or equal to another version
|
boolean |
isLowerThanOrEqualTo(String version) |
boolean |
isPreRelease()
Checks whether the version is a pre-release
|
boolean |
isStable()
Determines if the current version is stable or not.
|
Semver |
nextMajor() |
Semver |
nextMinor() |
Semver |
nextPatch() |
boolean |
satisfies(Requirement requirement)
Check if the version satisfies a requirement
|
boolean |
satisfies(String requirement)
Check if the version satisfies a requirement
|
Semver |
toStrict() |
String |
toString() |
Semver |
withBuild(String build) |
Semver |
withClearedBuild() |
Semver |
withClearedSuffix() |
Semver |
withClearedSuffixAndBuild() |
Semver |
withIncMajor() |
Semver |
withIncMajor(int increment) |
Semver |
withIncMinor() |
Semver |
withIncMinor(int increment) |
Semver |
withIncPatch() |
Semver |
withIncPatch(int increment) |
Semver |
withIncSuffix(int index) |
Semver |
withIncSuffix(int index,
int increment) |
Semver |
withSuffix(String suffix) |
public Semver(String value)
public Semver(String value, Semver.SemverType type)
public boolean satisfies(Requirement requirement)
requirement - the requirementpublic boolean satisfies(String requirement)
requirement - the requirementpublic boolean isPreRelease()
public boolean isGreaterThan(String version)
version - the version to compareisGreaterThan(Semver)public boolean isGreaterThan(Semver version)
version - the version to comparepublic boolean isGreaterThanOrEqualTo(String version)
version - the version to compareisGreaterThanOrEqualTo(Semver)public boolean isGreaterThanOrEqualTo(Semver version)
version - the version to comparepublic boolean isLowerThan(String version)
version - the version to compareisLowerThan(Semver)public boolean isLowerThan(Semver version)
version - the version to comparepublic boolean isLowerThanOrEqualTo(String version)
version - the version to compareisLowerThanOrEqualTo(Semver)public boolean isLowerThanOrEqualTo(Semver version)
version - the version to comparepublic boolean isEquivalentTo(String version)
version - the version to compareisEquivalentTo(Semver)public boolean isEquivalentTo(Semver version)
version - the version to comparepublic boolean isEqualTo(String version)
version - the version to compareisEqualTo(Semver)public boolean isEqualTo(Semver version)
version - the version to comparepublic boolean isStable()
public Semver.VersionDiff diff(String version)
version - the version to comparediff(Semver)public Semver.VersionDiff diff(Semver version)
version - the version to comparepublic Semver toStrict()
public Semver withIncMajor()
public Semver withIncMajor(int increment)
public Semver withIncMinor()
public Semver withIncMinor(int increment)
public Semver withIncPatch()
public Semver withIncPatch(int increment)
public Semver withIncSuffix(int index)
public Semver withIncSuffix(int index, int increment)
public Semver withClearedSuffix()
public Semver withClearedBuild()
public Semver withClearedSuffixAndBuild()
public Semver nextMajor()
public Semver nextMinor()
public Semver nextPatch()
public int compareTo(Semver version)
compareTo in interface Comparable<Semver>public String getOriginalValue()
public String getValue()
public Integer getMajor()
public Integer getMinor()
public Integer getPatch()
public String[] getSuffixTokens()
public String getBuild()
public Semver.SemverType getType()
Copyright © 2021. All rights reserved.