Package ai.djl.repository
Class VersionRange
- java.lang.Object
-
- ai.djl.repository.VersionRange
-
public final class VersionRange extends java.lang.ObjectAVersionRangeis a set ofRestrictions that match someVersions.A
VersionRangeshould 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 booleancontains(Artifact artifact)Returns true if the artifact's version falls within this range.booleancontains(Version version)Returns true if a version falls within this range.VersiongetRecommendedVersion()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 VersionRangeparse(java.lang.String spec)Creates a new version range from a string version range.java.lang.StringtoString()
-
-
-
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:
toStringin classjava.lang.Object
-
-