public final class VersionRange
extends java.lang.Object
VersionRange
is a set of Restriction
s that match some Version
s.
A VersionRange
should be constructed using parse(String)
. The
format used by the version ranges matches the maven
version range syntax.
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Artifact artifact)
Returns true if the artifact's version falls within this range.
|
boolean |
contains(Version version)
Returns true if a version falls within this range.
|
Version |
getRecommendedVersion()
Returns the recommended version in the range.
|
java.util.List<ai.djl.repository.Restriction> |
getRestrictions()
Returns the restrictions that compose the range.
|
java.util.List<Artifact> |
matches(java.util.List<Artifact> artifacts)
Filters the provided artifacts to those that match the version range.
|
static VersionRange |
parse(java.lang.String spec)
Creates a new version range from a string version range.
|
java.lang.String |
toString() |
public Version getRecommendedVersion()
public java.util.List<ai.djl.repository.Restriction> getRestrictions()
public static VersionRange parse(java.lang.String spec)
spec
- the string version rangeVersionRange
public java.util.List<Artifact> matches(java.util.List<Artifact> artifacts)
artifacts
- the artifacts to filterpublic boolean contains(Version version)
version
- the version to testpublic boolean contains(Artifact artifact)
artifact
- the artifact to testpublic java.lang.String toString()
toString
in class java.lang.Object