api / org.gradle.kotlin.dsl / KotlinClosure2

KotlinClosure2

class KotlinClosure2<in T, in U, V : Any> : Closure<V?>

Adapts a binary Kotlin function to a binary Groovy Closure.

Parameters

T - the type of the first argument.

U - the type of the second argument.

V - the return type.

function - the function to be adapted.

owner - optional owner of the Closure.

thisObject - optional this Object of the Closure.

See Also

Closure

Constructors

<init>

KotlinClosure2(function: (T, U) -> V?, owner: Any? = null, thisObject: Any? = null)

Adapts a binary Kotlin function to a binary Groovy Closure.

Properties

function

val function: (T, U) -> V?

the function to be adapted.

Functions

doCall

fun doCall(t: T, u: U): V?

Extension Functions

closureOf

fun <T> Any.closureOf(action: T.() -> Unit): Closure<Any?>

Adapts a Kotlin function to a single argument Groovy Closure.

delegateClosureOf

fun <T> Any.delegateClosureOf(action: T.() -> Unit): Closure<Unit>

Adapts a Kotlin function to a Groovy Closure that operates on the configured Closure delegate.

invoke

operator fun <T> Closure<T>.invoke(): T
operator fun <T> Closure<T>.invoke(x: Any?): T
operator fun <T> Closure<T>.invoke(vararg xs: Any?): T

withConvention

fun <ConventionType : Any, ReturnType> Any.withConvention(conventionType: KClass<ConventionType>, function: ConventionType.() -> ReturnType): ReturnType

Evaluates the given function against the convention plugin of the given conventionType.

withGroovyBuilder

fun <T> Any.withGroovyBuilder(builder: GroovyBuilderScope.() -> T): T

Executes the given builder against this object's GroovyBuilderScope.