Package org.eclipse.equinox.p2.metadata
Class VersionRange
java.lang.Object
org.eclipse.equinox.p2.metadata.VersionRange
- All Implemented Interfaces:
Serializable
This class represents a version range with Omni Version bounds. It is signature
equivalent with the OSGi org.eclipse.osgi.service.resolver.VersionRange
- Since:
- 2.0
- See Also:
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final VersionRange
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 Summary
ConstructorDescriptionVersionRange
(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. -
Method Summary
Modifier and TypeMethodDescriptionstatic VersionRange
Parses a version range from the specified string.boolean
Returns the version format.boolean
Indicates if the maximum version is included in the version range.boolean
Indicates if the minimum version is included in the version range.Returns the maximum Version of this VersionRangeReturns the minimum Version of this VersionRangeint
hashCode()
boolean
isIncluded
(Version version) Returns whether the given version is included in this VersionRange.boolean
Checks if the versions of this range is in compliance with the OSGi version spec.toString()
void
toString
(StringBuffer result) Deprecated.void
toString
(StringBuilder result)
-
Field Details
-
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. When the filter is evaluated an attempt is made to recreate them as OSGi versions. An empty OSGi Version range.
-
-
Constructor Details
-
VersionRange
Constructs a VersionRange with the specified minVersion and maxVersion.- Parameters:
minVersion
- the minimum version of the rangemaxVersion
- the maximum version of the range
-
VersionRange
Constructs a VersionRange from the given versionRange String.- Parameters:
versionRange
- a version range String that specifies a range of versions.
-
-
Method Details
-
create
Parses a version range from the specified string.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.
- Parameters:
versionRange
- String representation of the version range. Leading and trailing whitespace will be ignored.- Returns:
- A
VersionRange
object representing the version range ornull
ifversionRange
isnull
or an empty string. - Throws:
IllegalArgumentException
- IfversionRange
is improperly formatted.- Since:
- 2.4
-
getFormat
Returns the version format. -
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
Returns the maximum Version of this VersionRange- 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
-
intersect
-
isIncluded
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. (may benull
)- Returns:
true
if the version is include,false
otherwise
-
isOSGiCompatible
public boolean isOSGiCompatible()Checks if the versions of this range is in compliance with the OSGi version spec.- Returns:
- A flag indicating whether the range is OSGi compatible or not.
-
equals
-
hashCode
public int hashCode() -
toString
-
toString
Deprecated.usetoString(StringBuilder)
instead. -
toString
- Since:
- 2.9
-
toString(StringBuilder)
instead.