Class GradleMultiDependency

java.lang.Object
org.openrewrite.gradle.trait.GradleMultiDependency
All Implemented Interfaces:
org.openrewrite.trait.Trait<org.openrewrite.java.tree.J.MethodInvocation>

public class GradleMultiDependency extends Object implements org.openrewrite.trait.Trait<org.openrewrite.java.tree.J.MethodInvocation>
Represents one or more Gradle dependencies declared in a single method invocation. Gradle's groovy DLS allows invocations like: For varargs: implementation('g:a:1.0', 'g:a:2.0', 'dep3:3.0') There is not a corresponding dependency form in the kotlin DSL.
  • Constructor Details

    • GradleMultiDependency

      public GradleMultiDependency()
  • Method Details

    • getConfigurationName

      public String getConfigurationName()
      Gets the configuration name for these dependencies. For example, "implementation", "testImplementation", "api", etc.
      Returns:
      The configuration name
    • map

      public org.openrewrite.java.tree.J.MethodInvocation map(Function<GradleDependency,org.openrewrite.java.tree.J.MethodInvocation> mapper)
      Maps a transformation function over each GradleDependency in this multi-dependency that matches the provided DependencyMatcher. Returns a new J.MethodInvocation with updated arguments if any dependencies changed.
      Parameters:
      mapper - Function to transform each matching GradleDependency
      Returns:
      The updated J.MethodInvocation if any changes were made, or the original if not
    • forEach

      public void forEach(Consumer<GradleDependency> consumer)
    • matcher

      public static GradleMultiDependency.Matcher matcher()