# Interface MutableVersionConstraint

All Superinterfaces:
  `Describable, VersionConstraint`

public interface MutableVersionConstraint extends VersionConstraint
A configurable version constraint. This is exposed to the build author, so that one can express more constraints on a module version.

Since:
  4.4

- ## Method Summary

  Modifier and Type
  Method
  Description
  `@Nullable String`
  `getBranch()`
  Returns the branch to select versions from.
  `void`
  `prefer(String version)`
  Sets the preferred version of this module.
  `void`
  `reject(String... versions)`
  Declares a list of rejected versions.
  `void`
  `rejectAll()`
  Rejects all versions of this component.
  `void`
  `require(String version)`
  Sets the required version of this module.
  `void`
  `setBranch(@Nullable String branch)`
  Specifies the branch to select versions from.
  `void`
  `strictly(String version)`
  Sets the version as strict.

  ### Methods inherited from interface Describable

  `getDisplayName`

  ### Methods inherited from interface VersionConstraint

  `getPreferredVersion, getRejectedVersions, getRequiredVersion, getStrictVersion`

- ## Method Details

  - ### getBranch

    @Nullable String getBranch()
    Returns the branch to select versions from. When not `null`, select only versions that were built from the given branch.
    Specified by:
      `getBranch` in interface `VersionConstraint`
    Since:
      4.6

  - ### setBranch

    void setBranch(@Nullable String branch)
    Specifies the branch to select versions from.
    Parameters:
      `branch` - The branch, possibly null.
    Since:
      4.6

  - ### strictly

    void strictly(String version)
    Sets the version as strict.

    Any version not matched by this version notation will be excluded. This is the strongest version declaration. It will cause dependency resolution to fail if no version acceptable by this clause can be selected. This term supports dynamic versions.

    This will override a previous `require` declaration.

    This clears any set rejected versions.

    Parameters:
      `version` - the strict version to be used for this module
    Since:
      4.4

  - ### require

    void require(String version)
    Sets the required version of this module.

    Implies that the selected version cannot be lower than what `require` accepts but could be higher through conflict resolution, even if higher has an exclusive higher bound. This is what a direct dependency translates to. This term supports dynamic versions.

    This will override a previous `strictly` declaration.

    This clears any set rejected versions.

    Parameters:
      `version` - the required version of this module
    Since:
      5.0

  - ### prefer

    void prefer(String version)
    Sets the preferred version of this module.

    This is a very soft version declaration. It applies only if there is no stronger non dynamic opinion on a version for the module. This term does not support dynamic versions.

    This can complement a `strictly` or `require` indication.

    This clears any set rejected versions.

    Parameters:
      `version` - the preferred version of this module
    Since:
      4.4

  - ### reject

    void reject(String... versions)
    Declares a list of rejected versions. If such a version is found during dependency resolution, it will not be selected. This term supports dynamic versions.
    Parameters:
      `versions` - the rejected versions
    Since:
      4.5

  - ### rejectAll

    void rejectAll()
    Rejects all versions of this component. Can be used to make sure that if such a component is seen in a dependency graph, resolution fails.
    Since:
      4.5