Interface VersionConstraint

All Known Subinterfaces:
MutableVersionConstraint

@Incubating public interface VersionConstraint
Represents a constrained version. By default, when a dependency has a version number, it is assumed that the version can be upgraded during conflict resolution (typically, version 1.15 can be upgraded to 1.16). However in some cases we don't want this behavior. This class represents the base spec of module constraints.
Since:
4.4
  • Method Summary

    Modifier and Type
    Method
    Description
    The branch to select versions from.
    The preferred version of a module (which may be an exact version or a version range).
    Returns the list of versions that this module rejects (which may be exact versions, or ranges, anything that fits into a version string).
    The required version of a module (which may be an exact version or a version range).
    The strictly required version of a module (which may be an exact version or a version range).
  • Method Details

    • getBranch

      @Nullable String getBranch()
      The branch to select versions from. When not null selects only those versions that were built from the specified branch.
      Since:
      4.6
    • getRequiredVersion

      String getRequiredVersion()
      The required version of a module (which may be an exact version or a version range). The required version of a module can typically be upgraded during dependency resolution, but not downgraded.
      Returns:
      the required version, or empty string if no required version specified. Never null.
    • getPreferredVersion

      String getPreferredVersion()
      The preferred version of a module (which may be an exact version or a version range). The preferred version of a module provides a hint when resolving the version, but will not be honored in the presence of conflicting constraints.
      Returns:
      the preferred version, or empty string if no preferred version specified. Never null.
    • getStrictVersion

      String getStrictVersion()
      The strictly required version of a module (which may be an exact version or a version range). The required version of a module is strictly enforced and cannot be upgraded or downgraded during dependency resolution.
      Returns:
      the strict version, or empty string if no required version specified. Never null.
    • getRejectedVersions

      List<String> getRejectedVersions()
      Returns the list of versions that this module rejects (which may be exact versions, or ranges, anything that fits into a version string).
      Returns:
      the list of rejected versions