Class BundleVersion

java.lang.Object
org.openhab.core.addon.marketplace.BundleVersion

@NonNullByDefault public class BundleVersion extends Object
The BundleVersion wraps a bundle version and provides a method to compare them
Author:
Jan N. Klug - Initial contribution
  • Field Details

    • RANGE_PATTERN

      public static final Pattern RANGE_PATTERN
  • Constructor Details

    • BundleVersion

      public BundleVersion(String version)
  • Method Details

    • inRange

      public boolean inRange(@Nullable String range) throws IllegalArgumentException
      Test if this version is within the provided range
      Parameters:
      range - a Maven like version range
      Returns:
      true if this version is inside range, false otherwise
      Throws:
      IllegalArgumentException - if range does not represent a valid range
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(BundleVersion other)
      Compares two bundle versions
      Parameters:
      other - the other bundle version
      Returns:
      a positive integer if this version is newer than the other version, a negative number if this version is older than the other version and 0 if the versions are equal
    • toString

      public String toString()
      Overrides:
      toString in class Object