# create

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. A new instance of the given `instanceType` will be created using the given `constructionArguments`. The extension will be exposed as `publicType`. The new instance will have been dynamically made ExtensionAware, which means that you can cast it to ExtensionAware.

#### Return

The created instance

#### Since

3.5

#### Parameters

<T>

the extension public type

publicType

The extension public type

name

The name for the extension

instanceType

The extension instance type

constructionArguments

The arguments to be used to construct the extension instance

#### See also

add(Class, String, Object)

#### Throws

IllegalArgumentException

When an extension with the given name already exists.

abstract fun <T> create(name: String, type: Class<T>, constructionArguments: Array<Any>): T

Creates and adds a new extension to this container. A new instance of the given `type` will be created using the given `constructionArguments`. The extension will be exposed as `type` unless the extension itself declares a preferred public type via the org.gradle.api.reflect.HasPublicType protocol. The new instance will have been dynamically made ExtensionAware, which means that you can cast it to ExtensionAware.

#### Return

The created instance

#### Parameters

name

The name for the extension

type

The type of the extension

constructionArguments

The arguments to be used to construct the extension instance

#### See also

add(String, Object)

#### Throws

IllegalArgumentException

When an extension with the given name already exists.