# create

abstract fun <U : T?> create(name: String, type: Class<U>): U(source)

Creates a domain object with the specified name and type, and adds it to the container.

This operation is eager, the element is realized before being returned.

#### Return

the created domain object

#### Parameters

name

the name of the domain object to be created

type

the type of the domain object to be created

<U>

the type of the domain object to be created

#### Throws

org.gradle.api.InvalidUserDataException

if a domain object with the specified name already exists or the container does not support creating a domain object with the specified type

abstract fun <U : T?> create(name: String, type: Class<U>, configuration: Action<in U>): U(source)

Creates a domain object with the specified name and type, adds it to the container, and configures it with the specified action.

This operation is eager, the element is realized before being returned.

#### Return

the created domain object

#### Parameters

name

the name of the domain object to be created

type

the type of the domain object to be created

configuration

an action for configuring the domain object

<U>

the type of the domain object to be created

#### Throws

org.gradle.api.InvalidUserDataException

if a domain object with the specified name already exists or the container does not support creating a domain object with the specified type