Package org.apache.aries.util
Class VersionRange
java.lang.Object
org.apache.aries.util.VersionRange
-
Constructor Summary
ConstructorsConstructorDescriptionVersionRange(String version) VersionRange(String version, boolean exactVersion) This method should be used to create a version range from a single version string. -
Method Summary
Modifier and TypeMethodDescriptionbooleanthis method returns the exact version from the versionInfo obj.get the maximum versionget the minimum versioninthashCode()Create a new version range that is the intersection ofthisand the argument.booleancheck if the versioninfo is the exact versionbooleanis the maximum version exclusivebooleanis the maximum version unboundedbooleanis the minimum version exclusivebooleanThis method checks that the provided version matches the desired version.static VersionRangeParse a version range..static VersionRangeparseVersionRange(String s, boolean exactVersion) Parse a version range and indicate if the version is an exact versiontoString()
-
Constructor Details
-
VersionRange
- Parameters:
version- version for the verioninfo
-
VersionRange
This method should be used to create a version range from a single version string.- Parameters:
version- version for the versioninfoexactVersion- whether this is an exact versiontrueor goes to infinityfalse
-
-
Method Details
-
toString
-
hashCode
public int hashCode() -
equals
-
getExactVersion
this method returns the exact version from the versionInfo obj. this is used for DeploymentContent only to return a valid exact version otherwise, null is returned.- Returns:
- the exact version
-
getMaximumVersion
get the maximum version- Returns:
- the maximum version
-
getMinimumVersion
get the minimum version- Returns:
- the minimum version
-
isMaximumExclusive
public boolean isMaximumExclusive()is the maximum version exclusive- Returns:
- is the max version in the range.
-
isMaximumUnbounded
public boolean isMaximumUnbounded()is the maximum version unbounded- Returns:
- true if no upper bound was specified.
-
isMinimumExclusive
public boolean isMinimumExclusive()is the minimum version exclusive- Returns:
- true if the min version is in range.
-
matches
This method checks that the provided version matches the desired version.- Parameters:
version- the version.- Returns:
- true if the version matches, false otherwise.
-
isExactVersion
public boolean isExactVersion()check if the versioninfo is the exact version- Returns:
- true if the range will match 1 exact version.
-
intersect
Create a new version range that is the intersection ofthisand the argument. In other words, the largest version range that lies within boththisand the parameter.- Parameters:
r- a version range to be intersected withthis.- Returns:
- a new version range, or
nullif no intersection is possible.
-
parseVersionRange
Parse a version range..- Parameters:
s-- Returns:
- VersionRange object.
- Throws:
IllegalArgumentException- if the String could not be parsed as a VersionRange
-
parseVersionRange
public static VersionRange parseVersionRange(String s, boolean exactVersion) throws IllegalArgumentException Parse a version range and indicate if the version is an exact version- Parameters:
s-exactVersion-- Returns:
- VersionRange object.
- Throws:
IllegalArgumentException- if the String could not be parsed as a VersionRange
-