public class VersionRange extends Object
A browser filter which matches when a browser falls into a version range. Versions are
expected to match the semantics of DelimitedVersion.
| Modifier and Type | Field and Description |
|---|---|
static VersionRange |
ANY_VERSION
A version range that matches any delimited version.
|
| Constructor and Description |
|---|
VersionRange(DelimitedVersion lowerBound,
DelimitedVersion upperBound)
Creates a version range with the specified bounds.
|
| Modifier and Type | Method and Description |
|---|---|
static VersionRange |
atLeast(DelimitedVersion version)
Creates a version range that will match any version at or above the specified version.
|
static VersionRange |
atLeast(String version)
Creates a version range that will match any version at or above the specified version,
which will be parsed as a
DelimitedVersion. |
static VersionRange |
atMost(DelimitedVersion version)
Creates a version range that will match any version at or below the specified version.
|
static VersionRange |
atMost(String version)
Creates a version range that will match any version at or below the specified version,
which will be parsed as a
DelimitedVersion. |
static VersionRange |
between(String lowerBound,
String upperBound)
Creates a version range that will match any version equal to or between the specified
versions, which will be parsed as
DelimitedVersion instances. |
boolean |
matches(DelimitedVersion version)
Determines whether the specified version falls within the version range.
|
boolean |
matches(String version)
Determines whether the specified version (parsed as an
DelimitedVersion falls within
the version range. |
String |
toString() |
public static final VersionRange ANY_VERSION
A version range that matches any delimited version.
public VersionRange(@Nullable
DelimitedVersion lowerBound,
@Nullable
DelimitedVersion upperBound)
Creates a version range with the specified bounds. A null bound is treated as “no bound” on that end.
public static VersionRange atLeast(String version)
Creates a version range that will match any version at or above the specified version,
which will be parsed as a DelimitedVersion.
public static VersionRange atLeast(DelimitedVersion version)
Creates a version range that will match any version at or above the specified version.
public static VersionRange atMost(String version)
Creates a version range that will match any version at or below the specified version,
which will be parsed as a DelimitedVersion.
public static VersionRange atMost(DelimitedVersion version)
Creates a version range that will match any version at or below the specified version.
public static VersionRange between(String lowerBound, String upperBound)
Creates a version range that will match any version equal to or between the specified
versions, which will be parsed as DelimitedVersion instances.
public boolean matches(@NonNull
String version)
Determines whether the specified version (parsed as an DelimitedVersion falls within
the version range.
public boolean matches(@NonNull
DelimitedVersion version)
Determines whether the specified version falls within the version range.