public class VersionRange extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static VersionRange |
emptyRange
TODO: This should not be OSGi but it has to be that for now since the resolver creates
a filter where the min and max are converted into strings.
|
Constructor and Description |
---|
VersionRange(String versionRange)
Constructs a VersionRange from the given versionRange String.
|
VersionRange(Version minVersion,
boolean includeMin,
Version maxVersion,
boolean includeMax)
Constructs a VersionRange with the specified minVersion and maxVersion.
|
Modifier and Type | Method and Description |
---|---|
static VersionRange |
create(String versionRange)
Parses a version range from the specified string.
|
boolean |
equals(Object object) |
IVersionFormat |
getFormat()
Returns the version format.
|
boolean |
getIncludeMaximum()
Indicates if the maximum version is included in the version range.
|
boolean |
getIncludeMinimum()
Indicates if the minimum version is included in the version range.
|
Version |
getMaximum()
Returns the maximum Version of this VersionRange
|
Version |
getMinimum()
Returns the minimum Version of this VersionRange
|
int |
hashCode() |
VersionRange |
intersect(VersionRange r2) |
boolean |
isIncluded(Version version)
Returns whether the given version is included in this VersionRange.
|
boolean |
isOSGiCompatible()
Checks if the versions of this range is in compliance with the OSGi version spec.
|
String |
toString() |
void |
toString(StringBuffer result) |
public static final VersionRange emptyRange
public VersionRange(Version minVersion, boolean includeMin, Version maxVersion, boolean includeMax)
minVersion
- the minimum version of the rangemaxVersion
- the maximum version of the rangepublic VersionRange(String versionRange)
versionRange
- a version range String that specifies a range of
versions.public static VersionRange create(String versionRange)
Note that this method performs a non thread-safe object pooling. Instances are stored in a weak cache, i.e. for multiple calls with the same input it is likely but not guaranteed that the same instance is retrieved. Same holds for concurrent access on this method. Clients must not assume to get the same instance for subsequent calls.
versionRange
- String representation of the version range. Leading
and trailing whitespace will be ignored.VersionRange
object representing the version range
or null
if versionRange
is null
or
an empty string.IllegalArgumentException
- If versionRange
is improperly
formatted.public IVersionFormat getFormat()
public Version getMinimum()
public boolean getIncludeMinimum()
public Version getMaximum()
public boolean getIncludeMaximum()
public VersionRange intersect(VersionRange r2)
public boolean isIncluded(Version version)
version
- a version to be tested for inclusion in this VersionRange.
(may be null
)true
if the version is include,
false
otherwisepublic boolean isOSGiCompatible()
public void toString(StringBuffer result)
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.