public class VersionChecker<V extends Comparable<? super V>> extends Object
[1.0,3.5), where square brackets indicate an closed
boundary (includes the value) and parentheses indicates an open boundary (excludes the
actual value). Either of the left or right bounds can be dropped (but not both!) to to
indicate an half-bound. For example, [,4) will include any version up to but not
including version 4.0.
1.0 which acts as an interval with an open left bound and
akin to [1.0,)
<V>) is
pluggable. It must implement Comparable. The versions in the range must have at most 3
components (e.g., major.minor.micro).
This class exists as Gradle has no version-range-type class and Maven's org.apache.maven.artifact.versioning.VersionRange treats a single version as an exact bound.
Note that Gradle's org.gradle.util.GradleVersion class does not support
major-version-only versions.
| Constructor and Description |
|---|
VersionChecker(Function<String,V> converter) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
compatibleVersion(String acceptableVersionRange,
String actualVersion)
Return
true if actualVersion is contained within the version range represented
by acceptableVersionRange. |
public boolean compatibleVersion(String acceptableVersionRange, String actualVersion)
true if actualVersion is contained within the version range represented
by acceptableVersionRange.acceptableVersionRange - the encoded version rangeactualVersion - the version to be comparedIllegalArgumentException - if the version could not be parsedCopyright © 2019. All rights reserved.