Interface VersionConstraint


@Experimental public interface VersionConstraint
Version constraint for dependency. Constraint is either a range ("[1,2)") or recommended version ("1.0"). VersionConstraint objects are created using the VersionParser service.
Since:
4.0.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(Version version)
    Determines whether the specified version is contained within this constraint.
    Returns the recommended version of this constraint, or null if none.
    Returns the range of this constraint, or null if none.
    Returns the string representation of this version.
  • Method Details

    • getVersionRange

      @Nullable VersionRange getVersionRange()
      Returns the range of this constraint, or null if none.

      Note: only one, this method or getRecommendedVersion() method must return non-null value.

    • getRecommendedVersion

      @Nullable Version getRecommendedVersion()
      Returns the recommended version of this constraint, or null if none.

      Note: only one, this method or getVersionRange() method must return non-null value.

    • contains

      boolean contains(@Nonnull Version version)
      Determines whether the specified version is contained within this constraint.
      Parameters:
      version - the version to test, must not be null
      Returns:
      true if this range contains the specified version, false otherwise
    • toString

      @Nonnull String toString()
      Returns the string representation of this version.
      Overrides:
      toString in class Object
      Returns:
      the string representation of this version