# registerFactory

abstract fun <U : T?> registerFactory(type: Class<U>, factory: NamedDomainObjectFactory<out U>)(source)

Registers a factory for creating elements of the specified type. Typically, the specified type is an interface type.

#### Parameters

type

the type of objects created by the factory

factory

the factory to register

<U>

the type of objects created by the factory

#### Throws

java.lang.IllegalArgumentException

if the specified type is not a subtype of the container element type

abstract fun <U : T?> registerFactory(type: Class<U>, factory: Closure<out U>)(source)

Registers a factory for creating elements of the specified type. Typically, the specified type is an interface type.

#### Since

1.6

#### Parameters

type

the type of objects created by the factory

factory

the factory to register

<U>

the type of objects created by the factory

#### Throws

java.lang.IllegalArgumentException

if the specified type is not a subtype of the container element type