Class BundleVersion
- java.lang.Object
-
- org.openhab.core.addon.marketplace.BundleVersion
-
@NonNullByDefault public class BundleVersion extends Object
TheBundleVersion
wraps a bundle version and provides a method to compare them- Author:
- Jan N. Klug - Initial contribution
-
-
Field Summary
Fields Modifier and Type Field Description static Pattern
RANGE_PATTERN
-
Constructor Summary
Constructors Constructor Description BundleVersion(String version)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(BundleVersion other)
Compares two bundle versionsboolean
equals(@Nullable Object o)
int
hashCode()
boolean
inRange(@Nullable String range)
Test if this version is within the provided range
-
-
-
Field Detail
-
RANGE_PATTERN
public static final Pattern RANGE_PATTERN
-
-
Constructor Detail
-
BundleVersion
public BundleVersion(String version)
-
-
Method Detail
-
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
- ifrange
does not represent a valid range
-
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
-
-