public class VersionRange extends Object
| Modifier and Type | Method and Description |
|---|---|
static VersionRange |
any()
Any.
|
VersionRange |
cloneOf()
Clone of.
|
boolean |
containsVersion(ArtifactVersion version)
Contains version.
|
static VersionRange |
createFromVersion(String version)
Creates the from version.
|
static VersionRange |
createFromVersionSpec(String spec)
Create a version range from a string representation
Some spec examples are
1.0 Version 1.0
[1.0,2.0) Versions 1.0 (included) to 2.0 (not included)
[1.0,2.0] Versions 1.0 to 2.0 (both included)
[1.5,) Versions 1.5 and higher
(,1.0],[1.2,) Versions up to 1.0 (included) and 1.2 or
higher
|
boolean |
equals(Object obj) |
ArtifactVersion |
getRecommendedVersion()
Gets the recommended version.
|
List<Restriction> |
getRestrictions()
Gets the restrictions.
|
ArtifactVersion |
getSelectedVersion()
Gets the selected version.
|
int |
hashCode() |
boolean |
hasRestrictions()
Checks for restrictions.
|
boolean |
isSelectedVersionKnown()
Checks if is selected version known.
|
ArtifactVersion |
matchVersion(List<ArtifactVersion> versions)
Match version.
|
VersionRange |
restrict(VersionRange restriction)
Creates and returns a new
VersionRange that is a restriction
of this version range and the specified version range. |
String |
toString() |
public ArtifactVersion getRecommendedVersion()
public List<Restriction> getRestrictions()
public VersionRange cloneOf()
public static VersionRange any()
public static VersionRange createFromVersionSpec(String spec) throws InvalidVersionSpecificationException
1.0 Version 1.0[1.0,2.0) Versions 1.0 (included) to 2.0 (not included)
[1.0,2.0] Versions 1.0 to 2.0 (both included)[1.5,) Versions 1.5 and higher(,1.0],[1.2,) Versions up to 1.0 (included) and 1.2 or
higherspec - string representation of a version or version rangeVersionRange object that represents the specInvalidVersionSpecificationException - the invalid version specification exceptionpublic static VersionRange createFromVersion(String version)
version - the versionpublic VersionRange restrict(VersionRange restriction)
VersionRange that is a restriction
of this version range and the specified version range.
Note: Precedence is given to the recommended version from this version range over the recommended version from the specified version range.
restriction - the VersionRange that will be used to restrict
this version range.VersionRange that is a restriction of this
version range and the specified version range.
The restrictions of the returned version range will be an intersection of the restrictions of this version range and the specified version range if both version ranges have restrictions. Otherwise, the restrictions on the returned range will be empty.
The recommended version of the returned version range will be the
recommended version of this version range, provided that ranges
falls within the intersected restrictions. If the restrictions
are empty, this version range's recommended version is used if it
is not null. If it is null, the
specified version range's recommended version is used (provided
it is non-null). If no recommended version can be
obtained, the returned version range's recommended version is set
to null.
NullPointerException - if the specified VersionRange is
null.public ArtifactVersion getSelectedVersion()
public boolean isSelectedVersionKnown()
public ArtifactVersion matchVersion(List<ArtifactVersion> versions)
versions - the versionspublic boolean containsVersion(ArtifactVersion version)
version - the versionpublic boolean hasRestrictions()
Copyright © 2018. All rights reserved.