# container

inline fun <T> Project. container(): NamedDomainObjectContainer<T>(source)

Creates a container for managing named objects of the specified type.

The specified type must have a public constructor which takes the name as a String parameter.

All objects MUST expose their name as a bean property named `name`. The name must be constant for the life of the object.

#### Return

The container.

#### Parameters

T

The type of objects for the container to contain.

#### See also

Project.container

inline fun <T : Any> Project. container(noinline factory: (String) -> T): NamedDomainObjectContainer<T>(source)

Creates a container for managing named objects of the specified type.

The given factory is used to create object instances.

All objects MUST expose their name as a bean property named `name`. The name must be constant for the life of the object.

#### Return

The container.

#### Parameters

T

The type of objects for the container to contain.

factory

The factory to use to create object instances.

#### See also

Project.container

inline fun <T : Any> Project. container(type: KClass<T>): NamedDomainObjectContainer<T>(source)
inline fun <T : Any> Project. container(type: KClass<T>): NamedDomainObjectContainer<T>(source)
inline fun <T : Any> Project. container(type: KClass<T>, factory: NamedDomainObjectFactory<T>): NamedDomainObjectContainer<T>(source)
inline fun <T : Any> Project. container(type: KClass<T>, factory: NamedDomainObjectFactory<T>): NamedDomainObjectContainer<T>(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.Project.container.

#### See also

Project.container