Class VersionRange<Version extends Comparable<Version>>

java.lang.Object
io.strimzi.api.annotations.VersionRange<Version>
Type Parameters:
Version - The type of the version. This class assumes that older versions are less than newer versions and Comparable.compareTo(Object) is consistent with Object.equals(Object).

public class VersionRange<Version extends Comparable<Version>> extends Object
Represents a range over some comparable version type. Ranges can:
  1. be Empty
  2. consist of a single version
  3. consist of an inclusive lower bound and no upper bound
  4. consist of inclusive lower and upper bounds
It is possible to test inclusion of a given version in a version range and whether two version ranges possibly intersect.
  • Method Details

    • empty

      public static <Version extends Comparable<Version>> VersionRange<Version> empty()
      Returns an empty version range
      Type Parameters:
      Version - The type of version range.
      Returns:
      The empty version range.
    • all

      public static <Version extends Comparable<Version>> VersionRange<Version> all()
      Returns a VersionRange matching all versions
      Type Parameters:
      Version - The type of version range.
      Returns:
      VersionRange matching all versions
    • isEmpty

      public boolean isEmpty()
      Checks whether this version range is empty or not
      Returns:
      Returns true if this version range is empty. Returns false otherwise.
    • isAll

      public boolean isAll()
      Checks whether this version range matches all versions
      Returns:
      Returns true if this version range matches all versions. Returns false otherwise.
    • lower

      public Version lower()
      Returns the lower boundary of the version range
      Returns:
      The lower boundary of the range
    • upper

      public Version upper()
      Returns the upper boundary of the version range
      Returns:
      The upper boundary of the range
    • equals

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

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

      public boolean contains(Version apiVersion)
      Checks when the version is part of the version range
      Parameters:
      apiVersion - API Version which should be checked whether it is in the range or not
      Returns:
      True when the range contains the version. False otherwise
    • intersects

      public boolean intersects(VersionRange<Version> other)
      Checks whether two version ranges intersect
      Parameters:
      other - The version range which should be compared with this version range
      Returns:
      Returns true if the version ranges intersect. Returns false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object