Class VersionRange

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

public final class VersionRange extends Object
  • Constructor Details

    • 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 Details

    • 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 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 of this and the argument. In other words, the largest version range that lies within both this and the parameter.
      Parameters:
      r - 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