# ExtensionContainer

interface ExtensionContainer(source)

Allows adding 'namespaced' DSL extensions to a target object.

## Functions

add
Link copied to clipboard
abstract fun add(name: String, extension: Any)
abstract fun <T> add(publicType: Class<T>, name: String, extension: T)
abstract fun <T> add(publicType: TypeOf<T>, name: String, extension: T)
Adds a new extension to this container.
add
Link copied to clipboard
inline fun <T : Any> ExtensionContainer. add(name: String, extension: T)

Adds a new extension to this container.

inline fun <T : Any> ExtensionContainer. add(publicType: KClass<T>, name: String, extension: T)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.plugins.ExtensionContainer.add.

configure
Link copied to clipboard
abstract fun <T> configure(type: Class<T>, action: Action<in T>)
abstract fun <T> configure(type: TypeOf<T>, action: Action<in T>)
Looks for the extension of the specified type and configures it with the supplied action.
abstract fun <T> configure(name: String, action: Action<in T>)
Looks for the extension with the specified name and configures it with the supplied action.
configure
Link copied to clipboard
inline fun <T : Any> ExtensionContainer. configure(noinline action: T.() -> Unit)

Looks for the extension of the specified type and configures it with the supplied action.

inline fun <T : Any> ExtensionContainer. configure(type: KClass<T>, action: Action<in T>)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.plugins.ExtensionContainer.configure.

create
Link copied to clipboard
abstract fun <T> create(name: String, type: Class<T>, constructionArguments: Array<Any>): T
abstract fun <T> create(publicType: Class<T>, name: String, instanceType: Class<out T>, constructionArguments: Array<Any>): T
abstract fun <T> create(publicType: TypeOf<T>, name: String, instanceType: Class<out T>, constructionArguments: Array<Any>): T
Creates and adds a new extension to this container.
create
Link copied to clipboard
inline fun <T : Any> ExtensionContainer. create(name: String, vararg constructionArguments: Any): T

Creates and adds a new extension to this container.

inline fun <T : Any> ExtensionContainer. create(name: String, type: KClass<T>, vararg constructionArguments: Any): T
inline fun <T : Any> ExtensionContainer. create(publicType: KClass<T>, name: String, instanceType: KClass<out T>, vararg constructionArguments: Any): T
inline fun <T : Any> ExtensionContainer. create(publicType: TypeOf<T>, name: String, instanceType: KClass<out T>, vararg constructionArguments: Any): T

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.plugins.ExtensionContainer.create.

findByName
Link copied to clipboard
@Nullable
abstract fun findByName(name: String): @Nullable Any
Looks for the extension of a given name.
findByType
Link copied to clipboard
@Nullable
abstract fun <T> findByType(type: Class<T>): @Nullable T
@Nullable
abstract fun <T> findByType(type: TypeOf<T>): @Nullable T
Looks for the extension of a given type (useful to avoid casting).
findByType
Link copied to clipboard
inline fun <T : Any> ExtensionContainer. findByType(): T?

Looks for the extension of a given type.

inline fun <T : Any> ExtensionContainer. findByType(type: KClass<T>): T?

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.plugins.ExtensionContainer.findByType.

get
Link copied to clipboard
operator fun ExtensionContainer. get(name: String): Any

Looks for the extension of a given name. If none found it will throw an exception.

getByName
Link copied to clipboard
abstract fun getByName(name: String): Any
Looks for the extension of a given name.
getByName
Link copied to clipboard
inline fun <T : Any> ExtensionContainer. getByName(name: String): <Error class: unknown class>

Looks for the extension of a given name and casts it to the expected type T.

getByType
Link copied to clipboard
abstract fun <T> getByType(type: Class<T>): T
abstract fun <T> getByType(type: TypeOf<T>): T
Looks for the extension of a given type (useful to avoid casting).
getByType
Link copied to clipboard
inline fun <T : Any> ExtensionContainer. getByType(): T

Looks for the extension of a given type.

inline fun <T : Any> ExtensionContainer. getByType(type: KClass<T>): T

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.plugins.ExtensionContainer.getByType.

getExtensionsSchema
Link copied to clipboard
abstract fun getExtensionsSchema(): ExtensionsSchema
Provides access to the schema of all known extensions.
getExtraProperties
Link copied to clipboard
abstract fun getExtraProperties(): ExtraPropertiesExtension
The extra properties extension in this extension container.
getValue
Link copied to clipboard
inline operator fun <T : Any> ExtensionContainer. getValue(thisRef: Any?, property: KProperty<*>): T

Delegated property getter that locates extensions.