Class VersionRange
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final @NotNull VersionRangeSentinel value marking a version range which allows any value - corresponding to the string ','.static final @NotNull VersionRangeSentinel value marking a version range which accepts the latest versions defined by the 'release' field of the A-level metadata.xml file. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsVersion(MavenVersion version) @Nullable MavenVersionObtains the newest ("highest") recommended version that is within the version range.List<@NotNull MavenVersion>@NotNull VersionRangeintersect(@NotNull VersionRange version) static @NotNull VersionRange@Nullable MavenVersionselectFrom(@Nullable Collection<@NotNull MavenVersion> knownAvailable, @Nullable MavenVersion releaseVersion) toString()
-
Field Details
-
FREE_RANGE
Sentinel value marking a version range which allows any value - corresponding to the string ','.Note that for the maven artifact resolver, this concept does not exist. This concept does exist under picoresolve though as a convenience method to always select the newest version. Unlike
RELEASE,FREE_RANGEworks by selecting the newest version from the maven-metadata.xml whileRELEASEworks by selecting the advertised release version from the maven-metadata.xml file.- Implementation Note:
- The difference between
FREE_RANGEandRELEASEis wholly based on identity. Behaviour between the two instances only differs for theselectFrom(Collection, MavenVersion)method.
-
RELEASE
Sentinel value marking a version range which accepts the latest versions defined by the 'release' field of the A-level metadata.xml file. This generally corresponds to the newest non-snapshjot version published to the repositories.This field corresponds to the strings 'RELEASE' as well as '[RELEASE]' as the value of this field will be returned when trying to parse these values using
parse(String). Usage of the 'RELEASE' string is not permitted in version ranges - if this occurs, picoresolve will treat it as aMavenVersionversion string - that is a string literal with no meaning, but other resolver implementations might throw an error in that case.When using
parse(String)the case of the characters matters - that is the literal 'RELEASE' corresponds to this field, where as the literal 'release' would correspond to aMavenVersionwithout any special meaning.Note: The usage of this field is discouraged as it follows against the principle of reproducibility and stability, which for back-end software is generally not favourable.
- Implementation Note:
- The difference between
FREE_RANGEandRELEASEis wholly based on identity. Where as behaviour between the two instances only differs for theselectFrom(Collection, MavenVersion)method.Further,
RELEASElikeFREE_RANGEaccepts any values for a call tocontainsVersion(MavenVersion).
-
-
Method Details
-
parse
-
containsVersion
-
getRecommended
Obtains the newest ("highest") recommended version that is within the version range. If there are no recommended versions or if none of these versions match the constraints set up by the version range, null is returned.Note: In the absence of any explicit range rules, as is the case when a
VersionRangeis a plain version, then the recommended version will implicitly be treated as "pins". That is, they are the only allowed versions.- Returns:
- The highest recommended version that lies within the bounds of the version range.
-
getRecommendedVersions
-
intersect
-
selectFrom
@Nullable public @Nullable MavenVersion selectFrom(@Nullable @Nullable Collection<@NotNull MavenVersion> knownAvailable, @Nullable @Nullable MavenVersion releaseVersion) -
toString
-