org.apache.aries.util
Class VersionRange

java.lang.Object
  extended by org.apache.aries.util.VersionRange

public final class VersionRange
extends Object


Constructor Summary
VersionRange(String version)
           
VersionRange(String version, boolean exactVersion)
          This method should be used to create a version range from a single version string.
 
Method Summary
 boolean equals(Object other)
           
 org.osgi.framework.Version getExactVersion()
          this method returns the exact version from the versionInfo obj.
 org.osgi.framework.Version getMaximumVersion()
          get the maximum version
 org.osgi.framework.Version getMinimumVersion()
          get the minimum version
 int hashCode()
           
 VersionRange intersect(VersionRange r)
          Create a new version range that is the intersection of this and the argument.
 boolean isExactVersion()
          check if the versioninfo is the exact version
 boolean isMaximumExclusive()
          is the maximum version exclusive
 boolean isMaximumUnbounded()
          is the maximum version unbounded
 boolean isMinimumExclusive()
          is the minimum version exclusive
 boolean matches(org.osgi.framework.Version version)
          This method checks that the provided version matches the desired version.
static VersionRange parseVersionRange(String s)
          Parse a version range..
static VersionRange parseVersionRange(String s, boolean exactVersion)
          Parse a version range and indicate if the version is an exact version
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VersionRange

public VersionRange(String version)
Parameters:
version - version for the verioninfo

VersionRange

public VersionRange(String version,
                    boolean exactVersion)
This method should be used to create a version range from a single version string.

Parameters:
version - version for the versioninfo
exactVersion - whether this is an exact version true or goes to infinity false
Method Detail

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

getExactVersion

public org.osgi.framework.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 org.osgi.framework.Version getMaximumVersion()
get the maximum version

Returns:
the maximum version

getMinimumVersion

public org.osgi.framework.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(org.osgi.framework.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 of this and the argument. In other words, the largest version range that lies within both this and the parameter.

Parameters:
range - a version range to be intersected with this.
Returns:
a new version range, or null if no intersection is possible.

parseVersionRange

public static VersionRange parseVersionRange(String s)
                                      throws IllegalArgumentException
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


Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.