api / org.gradle.api / HasImplicitReceiver

HasImplicitReceiver

@Target([AnnotationTarget.CLASS, AnnotationTarget.FILE]) class HasImplicitReceiver

Marks a SAM interface as a target for lambda expressions / closures where the single parameter is passed as the implicit receiver of the invocation (this in Kotlin, delegate in Groovy) as if the lambda expression was an extension method of the parameter type.

 // copySpec(Action<CopySpec>) copySpec { from("./sources") // the given CopySpec is the implicit receiver } 

Since
3.5

Constructors

<init>

HasImplicitReceiver()

Marks a SAM interface as a target for lambda expressions / closures where the single parameter is passed as the implicit receiver of the invocation (this in Kotlin, delegate in Groovy) as if the lambda expression was an extension method of the parameter type.

 // copySpec(Action<CopySpec>) copySpec { from("./sources") // the given CopySpec is the implicit receiver }