Class SemVerRange

java.lang.Object
xyz.rk0cc.josev.SemVerRange
All Implemented Interfaces:
Serializable, SemVerDetermineInRange
Direct Known Subclasses:
SemVerConstraint

public class SemVerRange extends Object implements Serializable, SemVerDetermineInRange
Define range of the SemVer.
Since SemVer contains pre-release and build tag which they are String and difficult to predict next SemVer in a Collection. As a result, determine is in range with SemVer.isGreater(SemVer), SemVer.isLower(SemVer) or more.
Using to assign version constraint class SemVerConstraint is inherited from SemVerRange.
Since:
1.0.0
See Also:
  • Constructor Details

    • SemVerRange

      public SemVerRange(SemVerRangeNode start, SemVerRangeNode end)
      Create new range definition of SemVer.
      Parameters:
      start - The range start from.
      end - The range end at.
  • Method Details

    • start

      public SemVerRangeNode start()
      A node which specify the minimum version that can be accepted (Assume no version omitted between start and start).
      Returns:
      A node of version information that can be assembled to traditional syntax.
      See Also:
    • end

      public SemVerRangeNode end()
      A node which specify the maximum version that can be accepted (Assume no version omitted between start and end).
      Returns:
      A node of version information that can be assembled to traditional syntax.
      See Also:
    • isInRange

      public boolean isInRange(@Nonnull SemVer semVer)
      Check this semVer is in the range.
      Mostly, pre-release version is not consider in the range. It will has proper document if this accepts pre-release of SemVer.
      Specified by:
      isInRange in interface SemVerDetermineInRange
      Parameters:
      semVer - A version that to determine is in the constraint range.
      Returns:
      true if in range.
    • isInRange

      public final boolean isInRange(@Nonnull String semVer) throws NonStandardSemVerException
      Check this semVer is in the range.
      Specified by:
      isInRange in interface SemVerDetermineInRange
      Parameters:
      semVer - A version that to determine is in the constraint range.
      Returns:
      true if in range.
      Throws:
      NonStandardSemVerException - When semVer String can not be parsed.