Package org.apache.aries.util
Class VersionRange
- java.lang.Object
-
- org.apache.aries.util.VersionRange
-
public final class VersionRange extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description VersionRange(java.lang.String version)
VersionRange(java.lang.String version, boolean exactVersion)
This method should be used to create a version range from a single version string.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
Version
getExactVersion()
this method returns the exact version from the versionInfo obj.Version
getMaximumVersion()
get the maximum versionVersion
getMinimumVersion()
get the minimum versionint
hashCode()
VersionRange
intersect(VersionRange r)
Create a new version range that is the intersection ofthis
and the argument.boolean
isExactVersion()
check if the versioninfo is the exact versionboolean
isMaximumExclusive()
is the maximum version exclusiveboolean
isMaximumUnbounded()
is the maximum version unboundedboolean
isMinimumExclusive()
is the minimum version exclusiveboolean
matches(Version version)
This method checks that the provided version matches the desired version.static VersionRange
parseVersionRange(java.lang.String s)
Parse a version range..static VersionRange
parseVersionRange(java.lang.String s, boolean exactVersion)
Parse a version range and indicate if the version is an exact versionjava.lang.String
toString()
-
-
-
Constructor Detail
-
VersionRange
public VersionRange(java.lang.String version)
- Parameters:
version
- version for the verioninfo
-
VersionRange
public VersionRange(java.lang.String version, boolean exactVersion)
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 versiontrue
or goes to infinityfalse
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
getExactVersion
public Version 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
public Version getMaximumVersion()
get the maximum version- Returns:
- the maximum version
-
getMinimumVersion
public 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
public boolean matches(Version version)
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
public VersionRange intersect(VersionRange r)
Create a new version range that is the intersection ofthis
and the argument. In other words, the largest version range that lies within boththis
and the parameter.- Parameters:
r
- a version range to be intersected withthis
.- Returns:
- a new version range, or
null
if no intersection is possible.
-
parseVersionRange
public static VersionRange parseVersionRange(java.lang.String s) throws java.lang.IllegalArgumentException
Parse a version range..- Parameters:
s
-- Returns:
- VersionRange object.
- Throws:
java.lang.IllegalArgumentException
- if the String could not be parsed as a VersionRange
-
parseVersionRange
public static VersionRange parseVersionRange(java.lang.String s, boolean exactVersion) throws java.lang.IllegalArgumentException
Parse a version range and indicate if the version is an exact version- Parameters:
s
-exactVersion
-- Returns:
- VersionRange object.
- Throws:
java.lang.IllegalArgumentException
- if the String could not be parsed as a VersionRange
-
-