api / org.gradle.api / NamedDomainObjectContainer / create

create

abstract fun create(name: String): T

Creates a new item with the given name, adding it to this container.

Parameters

name - The name to assign to the created object

Exceptions

InvalidUserDataException - if an object with the given name already exists in this container.

Return
The created object. Never null.

abstract fun create(name: String, configureClosure: Closure<Any>): T

Creates a new item with the given name, adding it to this container, then configuring it with the given closure.

Parameters

name - The name to assign to the created object

configureClosure - The closure to configure the created object with

Exceptions

InvalidUserDataException - if an object with the given name already exists in this container.

Return
The created object. Never null.

abstract fun create(name: String, configureAction: Action<in T>): T

Creates a new item with the given name, adding it to this container, then configuring it with the given action.

Parameters

name - The name to assign to the created object

configureAction - The action to configure the created object with

Exceptions

InvalidUserDataException - if an object with the given name already exists in this container.

Return
The created object. Never null.