Package ai.djl.repository
Class VersionRange
- java.lang.Object
-
- ai.djl.repository.VersionRange
-
public final class VersionRange extends java.lang.Object
AVersionRange
is a set ofRestriction
s that match someVersion
s.A
VersionRange
should be constructed usingparse(String)
. The format used by the version ranges matches the maven version range syntax.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Method Detail
-
getRecommendedVersion
public Version getRecommendedVersion()
Returns the recommended version in the range.- Returns:
- the recommended version in the range
-
getRestrictions
public java.util.List<ai.djl.repository.Restriction> getRestrictions()
Returns the restrictions that compose the range.- Returns:
- the restrictions that compose the range
-
parse
public static VersionRange parse(java.lang.String spec)
Creates a new version range from a string version range.- Parameters:
spec
- the string version range- Returns:
- the
VersionRange
-
matches
public java.util.List<Artifact> matches(java.util.List<Artifact> artifacts)
Filters the provided artifacts to those that match the version range.- Parameters:
artifacts
- the artifacts to filter- Returns:
- the filtered artifacts
-
contains
public boolean contains(Version version)
Returns true if a version falls within this range.- Parameters:
version
- the version to test- Returns:
- true if the version falls within this range
-
contains
public boolean contains(Artifact artifact)
Returns true if the artifact's version falls within this range.- Parameters:
artifact
- the artifact to test- Returns:
- true if the artifact's version falls within this range
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-