Interface VersionConstraint

All Known Implementing Classes:
CaretConstraint, CompositeConstraint, ExactVersionConstraint, OrConstraint, RangeConstraint, TildeConstraint

public interface VersionConstraint
Represents a version constraint that can evaluate whether specific versions satisfy its defined rules and conditions.

This interface allows diverse implementations for different types of version constraints, such as ranges, exact matches, or semantic versioning rules.

The constraints may define minimum and/or maximum boundary conditions, equality rules, or complex logical combinations of multiple constraints.

  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the lowest version that satisfies the version constraint.
    Retrieves the highest version defined by the version constraint.
    Retrieves a list of version constraints represented as strings.
    Retrieves the original constraint string as it was input or defined.
    boolean
    satisfies(Version version)
    Determines if the given version satisfies the constraints defined by this implementation.
  • Method Details

    • satisfies

      boolean satisfies(Version version)
      Determines if the given version satisfies the constraints defined by this implementation.
      Parameters:
      version - the version to be checked against the constraints
      Returns:
      true if the version satisfies the constraints, false otherwise
    • original

      String original()
      Retrieves the original constraint string as it was input or defined.
      Returns:
      the original version constraint string that was used to create this constraint.
    • getVersions

      List<String> getVersions()
      Retrieves a list of version constraints represented as strings.

      This method aggregates all conditions that define valid versions and returns them in a standardized string format for further interpretation or display.

      Returns:
      a list of strings where each string specifies a version constraint.
    • getLowVersion

      String getLowVersion()
      Retrieves the lowest version that satisfies the version constraint.

      The result depends on how the specific implementation computes the lowest version. It may return null if the constraint defines no minimum version.

      Returns:
      the lowest version as a string
    • getMaxVersion

      String getMaxVersion()
      Retrieves the highest version defined by the version constraint.

      Depending on the implementing class, this may involve calculating the maximum version based on one or more underlying version constraints.

      Returns:
      the maximum version as a string