Class VersionRange

java.lang.Object
io.spring.initializr.generator.version.VersionRange

public class VersionRange extends Object
Define a Version range. A square bracket "[" or "]" denotes an inclusive end of the range and a round bracket "(" or ")" denotes an exclusive end of the range. A range can also be unbounded by defining a a single Version. The examples below make this clear.
  • "[1.2.0.RELEASE,1.3.0.RELEASE)" version 1.2.0 and any version after this, up to, but not including, version 1.3.0.
  • "(2.0.0,3.2.0]" any version after 2.0.0 up to and including version 3.2.0.
  • "2.5.0-M1", the first milestone of 2.5.0 and any version after that.
Author:
Stephane Nicoll
  • Constructor Details

    • VersionRange

      protected VersionRange(Version lowerVersion, boolean lowerInclusive, Version higherVersion, boolean higherInclusive)
    • VersionRange

      public VersionRange(Version startingVersion)
  • Method Details

    • match

      public boolean match(Version version)
      Specify if the Version matches this range. Returns true if the version is contained within this range, false otherwise.
      Parameters:
      version - the version to check
      Returns:
      true if the version matches
    • format

      public VersionRange format(Version.Format format)
      Format this version range to the specified Version.Format.
      Parameters:
      format - the version format to use
      Returns:
      a version range whose boundaries are compliant with the specified format.
    • getLowerVersion

      public Version getLowerVersion()
    • isLowerInclusive

      public boolean isLowerInclusive()
    • getHigherVersion

      public Version getHigherVersion()
    • isHigherInclusive

      public boolean isHigherInclusive()
    • toRangeString

      public String toRangeString()
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object