Package org.openrewrite.gradle.trait
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidforEach(Consumer<GradleDependency> consumer) Gets the configuration name for these dependencies.org.openrewrite.java.tree.J.MethodInvocationmap(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.matcher()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openrewrite.trait.Trait
getCursor, getTree
-
Constructor Details
-
GradleMultiDependency
public GradleMultiDependency()
-
-
Method Details
-
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
-
matcher
-