public class Requirement extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Requirement.RequirementOperator
The operators that can be used in a requirement.
|
| Modifier and Type | Field and Description |
|---|---|
protected Requirement.RequirementOperator |
op |
protected Range |
range |
protected Requirement |
req1 |
protected Requirement |
req2 |
| Modifier | Constructor and Description |
|---|---|
protected |
Requirement(Range range,
Requirement req1,
Requirement.RequirementOperator op,
Requirement req2)
Builds a requirement.
|
| Modifier and Type | Method and Description |
|---|---|
static Requirement |
build(Semver requirement)
Builds a requirement (will test that the version is equivalent to the requirement)
|
static Requirement |
buildCocoapods(String requirement)
Builds a requirement following the rules of Cocoapods.
|
static Requirement |
buildIvy(String requirement)
Builds a requirement following the rules of Ivy.
|
static Requirement |
buildLoose(String requirement)
Builds a loose requirement (will test that the version is equivalent to the requirement)
|
static Requirement |
buildNPM(String requirement)
Builds a requirement following the rules of NPM.
|
static Requirement |
buildStrict(String requirement)
Builds a strict requirement (will test that the version is equivalent to the requirement)
|
protected static Requirement |
caretRequirement(String version,
Semver.SemverType type)
Allows changes that do not modify the left-most non-zero digit in the [major, minor, patch] tuple.
|
boolean |
equals(Object o) |
Semver.SemverType |
getType() |
int |
hashCode() |
protected static Requirement |
hyphenRequirement(String lowerVersion,
String upperVersion,
Semver.SemverType type)
Creates a requirement that satisfies "x1.y1.z1 - x2.y2.z2".
|
boolean |
isSatisfiedBy(Semver version)
Checks if the requirement is satisfied by a version.
|
boolean |
isSatisfiedBy(String version) |
protected static Requirement |
tildeRequirement(String version,
Semver.SemverType type)
Allows patch-level changes if a minor version is specified on the comparator.
|
String |
toString() |
protected final Range range
protected final Requirement req1
protected final Requirement.RequirementOperator op
protected final Requirement req2
protected Requirement(Range range, Requirement req1, Requirement.RequirementOperator op, Requirement req2)
range - the range that will be used for the requirement (optional if all other params are provided)req1 - the requirement used as a left operand (requires the `op` and `req2` params to be provided)op - the operator used between the requirements (requires the `req1` and `req2` params to be provided)req2 - the requirement used as a right operand (requires the `req1` and `op` params to be provided)public static Requirement build(Semver requirement)
requirement - the version of the requirementpublic static Requirement buildStrict(String requirement)
requirement - the version of the requirementpublic static Requirement buildLoose(String requirement)
requirement - the version of the requirementpublic static Requirement buildNPM(String requirement)
requirement - the requirement as a stringpublic static Requirement buildCocoapods(String requirement)
requirement - the requirement as a stringpublic static Requirement buildIvy(String requirement)
requirement - the requirement as a stringprotected static Requirement tildeRequirement(String version, Semver.SemverType type)
version - the version of the requirementtype - the version system used for this requirementprotected static Requirement caretRequirement(String version, Semver.SemverType type)
version - the version of the requirementtype - the version system used for this requirementprotected static Requirement hyphenRequirement(String lowerVersion, String upperVersion, Semver.SemverType type)
lowerVersion - the version of the lower bound of the requirementupperVersion - the version of the upper bound of the requirementtype - the version system used for this requirementpublic Semver.SemverType getType()
public boolean isSatisfiedBy(String version)
version - the version that will be checkedisSatisfiedBy(Semver)public boolean isSatisfiedBy(Semver version)
version - the version that will be checkedCopyright © 2021. All rights reserved.