# registerFactory

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

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

IllegalArgumentException

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