DependencyMetadata (Gradle API 8.11.1)

Package org.gradle.api.artifacts

## Interface DependencyMetadata<SELF extends DependencyMetadata>

- Type Parameters:
    `SELF` - type extending this interface
  All Known Subinterfaces:
    `DependencyConstraintMetadata`, `DirectDependencyMetadata`

      public interface DependencyMetadata<SELF extends DependencyMetadata>

  Describes a metadata about a dependency - direct dependency or dependency constraint - declared in a resolved component's metadata.
  Since:
    4.4

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SELF` | `attributes​(Action<? super AttributeContainer> configureAction)` | Adjust the attributes of this dependency
    `SELF` | `because​(java.lang.String reason)` | Adjust the reason why this dependency should be selected.
    `AttributeContainer` | `getAttributes()` | Returns the attributes of this dependency.
    `java.lang.String` | `getGroup()` | Returns the group of the module that is targeted by this dependency or dependency constraint.
    `ModuleIdentifier` | `getModule()` | The module identifier of the component.
    `java.lang.String` | `getName()` | Returns the name of the module that is targeted by this dependency or dependency constraint.
    `java.lang.String` | `getReason()` | Returns the reason why this dependency should be selected.
    `VersionConstraint` | `getVersionConstraint()` | Returns the version of the module that is targeted by this dependency or dependency constraint.
    `SELF` | `version​(Action<? super MutableVersionConstraint> configureAction)` | Adjust the version constraints of the dependency or dependency constraint.

- - ### Method Detail

    - #### getGroup

          java.lang.String getGroup()

      Returns the group of the module that is targeted by this dependency or dependency constraint. The group allows the definition of modules of the same name in different organizations or contexts.

    - #### getName

          java.lang.String getName()

      Returns the name of the module that is targeted by this dependency or dependency constraint.

    - #### getVersionConstraint

          VersionConstraint getVersionConstraint()

      Returns the version of the module that is targeted by this dependency or dependency constraint. which usually expresses what API level of the module you are compatible with.
      Since:
        4.5

    - #### version

          SELF version​(Action<? super MutableVersionConstraint> configureAction)

      Adjust the version constraints of the dependency or dependency constraint.
      Parameters:
        `configureAction` - modify version details
      Since:
        4.5

    - #### getReason

          @Nullable
          java.lang.String getReason()

      Returns the reason why this dependency should be selected.
      Returns:
        the reason, or null if no reason is found in metadata.
      Since:
        4.6

    - #### because

          SELF because​(java.lang.String reason)

      Adjust the reason why this dependency should be selected.
      Parameters:
        `reason` - modified reason
      Since:
        4.6

    - #### getAttributes

          AttributeContainer getAttributes()

      Returns the attributes of this dependency.
      Returns:
        the attributes of this dependency
      Since:
        4.8

    - #### attributes

          SELF attributes​(Action<? super AttributeContainer> configureAction)

      Adjust the attributes of this dependency
      Since:
        4.8

    - #### getModule

          ModuleIdentifier getModule()

      The module identifier of the component. Returns the same information as `getGroup()` and `getName()`.
      Returns:
        the module identifier
      Since:
        4.9