Package org.gradle.api.artifacts.dsl

## Interface DependencyModifier

- All Known Implementing Classes:
    `PlatformDependencyModifiers.EnforcedPlatformDependencyModifier`, `PlatformDependencyModifiers.PlatformDependencyModifier`, `TestFixturesDependencyModifiers.TestFixturesDependencyModifier`

      @Incubating
      @NonExtensible
      public interface DependencyModifier

  A `DependencyModifier` defines how to modify a dependency inside a custom `dependencies` block to select a different variant.
  Since:
    8.0
  API Note:
    Gradle has specific extensions to make explicit calls to `modify(...)` unnecessary from the DSL.
    - For Groovy DSL, we create `call(...)` equivalents for all the `modify(...)` methods.
    - For Kotlin DSL, we create `invoke(...)` equivalents for all the `modify(...)` methods.
  Implementation Requirements:
    The default implementation of all methods should not be overridden except `modify(ModuleDependency)`. This method must be implemented.
  Implementation Note:
    All other implementations of `modify(...)` delegate to `modify(ModuleDependency)`.

    Changes to this interface may require changes to the `extension module for Groovy DSL` or `extension functions for Kotlin DSL`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `DependencyFactory` | `getDependencyFactory()` | A dependency factory is used to convert supported dependency notations into `Dependency` instances.
    `<D extends ModuleDependency> D` | `modify​(D dependency)` | Takes a given `ModuleDependency` and modifies the dependency to select the variant of the given module.
    `default ExternalModuleDependency` | `modify​(java.lang.CharSequence dependencyNotation)` | Create an `ExternalModuleDependency` from the given notation and modifies it to select the variant of the given module as described in `modify(ModuleDependency)`.
    `default <D extends ModuleDependency> Provider<D>` | `modify​(Provider<D> providerToDependency)` | Takes a given `Provider` to a `ExternalModuleDependency` and modifies the dependency to select the variant of the given module as described in `modify(ModuleDependency)`.
    `default Provider<? extends MinimalExternalModuleDependency>` | `modify​(ProviderConvertible<? extends MinimalExternalModuleDependency> providerConvertibleToDependency)` | Takes a given `Provider` to a `MinimalExternalModuleDependency` and modifies the dependency to select the variant of the given module as described in `modify(ModuleDependency)`.

- - ### Method Detail

    - #### getDependencyFactory

          @Inject
          DependencyFactory getDependencyFactory()

      A dependency factory is used to convert supported dependency notations into `Dependency` instances.
      Returns:
        a dependency factory
      See Also:
        `DependencyFactory`
      Implementation Requirements:
        Do not implement this method. Gradle generates the implementation automatically.

    - #### modify

          default ExternalModuleDependency modify​(java.lang.CharSequence dependencyNotation)

      Create an `ExternalModuleDependency` from the given notation and modifies it to select the variant of the given module as described in `modify(ModuleDependency)`.
      Parameters:
        `dependencyNotation` - the dependency notation
      Returns:
        the modified dependency
      See Also:
        `DependencyFactory.create(CharSequence)`

    - #### modify

          default Provider<? extends MinimalExternalModuleDependency> modify​(ProviderConvertible<? extends MinimalExternalModuleDependency> providerConvertibleToDependency)

      Takes a given `Provider` to a `MinimalExternalModuleDependency` and modifies the dependency to select the variant of the given module as described in `modify(ModuleDependency)`.
      Parameters:
        `providerConvertibleToDependency` - the provider
      Returns:
        a provider to the modified dependency

    - #### modify

          default <D extends ModuleDependency> Provider<D> modify​(Provider<D> providerToDependency)

      Takes a given `Provider` to a `ExternalModuleDependency` and modifies the dependency to select the variant of the given module as described in `modify(ModuleDependency)`.
      Parameters:
        `providerToDependency` - the provider
      Returns:
        a provider to the modified dependency

    - #### modify

          <D extends ModuleDependency> D modify​(D dependency)

      Takes a given `ModuleDependency` and modifies the dependency to select the variant of the given module. Dependency resolution may fail if the given module does not have a compatible variant.

      Type Parameters:
        `D` - the type of the `ModuleDependency`
      Parameters:
        `dependency` - the dependency to modify
      Returns:
        the modified dependency
      Implementation Requirements:
        This method must be implemented.