abstract fun <T : Any> container(type: Class<T>): NamedDomainObjectContainer<T>
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.
type
- The type of objects for the container to contain.
- The type of objects for the container to contain.
Return
The container.
abstract fun <T : Any> container(type: Class<T>, factory: NamedDomainObjectFactory<T>): NamedDomainObjectContainer<T>
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.
type
- The type of objects for the container to contain.
factory
- The factory to use to create object instances.
- The type of objects for the container to contain.
Return
The container.
abstract fun <T : Any> container(type: Class<T>, factoryClosure: Closure<Any>): NamedDomainObjectContainer<T>
Creates a container for managing named objects of the specified type. The given closure is used to create object instances. The name of the instance to be created is passed as a parameter to the closure.
All objects MUST expose their name as a bean property named "name". The name must be constant for the life of the object.
type
- The type of objects for the container to contain.
factoryClosure
- The closure to use to create object instances.
- The type of objects for the container to contain.
Return
The container.