Class VersionRange
- java.lang.Object
-
- org.osgi.framework.VersionRange
-
- org.eclipse.osgi.service.resolver.VersionRange
-
public class VersionRange extends VersionRange
This class represents a version range.- Since:
- 3.1
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static VersionRange
emptyRange
An empty version range: "0.0.0".-
Fields inherited from class org.osgi.framework.VersionRange
LEFT_CLOSED, LEFT_OPEN, RIGHT_CLOSED, RIGHT_OPEN
-
-
Constructor Summary
Constructors Constructor Description VersionRange(String versionRange)
Creates a version range from the specified string.VersionRange(Version minVersion, boolean includeMin, Version maxVersion, boolean includeMax)
Constructs a VersionRange with the specified minVersion and maxVersion.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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()
Deprecated.Version
getMinimum()
Returns the minimum Version of this VersionRange.boolean
isIncluded(Version version)
Returns whether the given version is included in this VersionRange.-
Methods inherited from class org.osgi.framework.VersionRange
equals, getLeft, getLeftType, getRight, getRightType, hashCode, includes, intersection, isEmpty, isExact, toFilterString, toString, valueOf
-
-
-
-
Field Detail
-
emptyRange
public static final VersionRange emptyRange
An empty version range: "0.0.0". The empty version range includes all valid versions (any version greater than or equal to the version 0.0.0).
-
-
Constructor Detail
-
VersionRange
public VersionRange(Version minVersion, boolean includeMin, Version maxVersion, boolean includeMax)
Constructs a VersionRange with the specified minVersion and maxVersion.- Parameters:
minVersion
- the minimum version of the range. Ifnull
thenVersion.emptyVersion
is used.maxVersion
- the maximum version of the range. Ifnull
then new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE) is used.
-
VersionRange
public VersionRange(String versionRange)
Creates a version range from the specified string.Here is the grammar for version range strings.
version-range ::= interval | atleast interval ::= ( include-min | exclude-min ) min-version ',' max-version ( include-max | exclude-max ) atleast ::= version floor ::= version ceiling ::= version include-min ::= '[' exclude-min ::= '(' include-max ::= ']' exclude-max ::= ')'
- Parameters:
versionRange
- string representation of the version range ornull
for the empty range "0.0.0"- See Also:
definition of version
-
-
Method Detail
-
getMinimum
public Version getMinimum()
Returns the minimum Version of this VersionRange.- Returns:
- the minimum Version of this VersionRange
-
getIncludeMinimum
public boolean getIncludeMinimum()
Indicates if the minimum version is included in the version range.- Returns:
- true if the minimum version is included in the version range; otherwise false is returned
-
getMaximum
public Version getMaximum()
Deprecated.Returns the maximum Version of this VersionRange.This method is deprecated. For ranges that have no maximum this method incorrectly returns a version equal to
Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE)
. UseVersionRange.getRight()
instead.- Returns:
- the maximum Version of this VersionRange
-
getIncludeMaximum
public boolean getIncludeMaximum()
Indicates if the maximum version is included in the version range.- Returns:
- true if the maximum version is included in the version range; otherwise false is returned
-
isIncluded
public boolean isIncluded(Version version)
Returns whether the given version is included in this VersionRange. This will depend on the minimum and maximum versions of this VersionRange and the given version.- Parameters:
version
- a version to be tested for inclusion in this VersionRange. Ifnull
thenVersion.emptyVersion
is used.- Returns:
true
if the version is included,false
otherwise
-
-