SingletonContainer

Singleton container.

It creates objects from ObjectFactory implementations and sets them as long as it lives in application.

Constructors

this
this()

* Default constructor for SingletonContainer

Members

Functions

get
Object get(string key)

* Get object created by a factory identified by key * * Params: * key = identity of factory * Returns: * Object

getFactories
InputRange!(Pair!(ObjectFactory, string)) getFactories()

Get all factories available in container.

getFactory
ObjectFactory getFactory(string identity)

Get factory for constructed component identified by identity.

has
bool has(string key)

* Check if an object factory for it exists in container. * * Params: * key = identity of factory * Returns: * bool

instantiate
SingletonContainer instantiate()

Sets up the internal state of container.

link
SingletonContainer link(string key, string alias_)

Alias a key to an alias_.

remove
SingletonContainer remove(string key)

* Remove an object factory from container. * * Params: * key = identity of factory to be removed * Returns: * typeof(this)

resolve
const(string) resolve(string key)

Resolve an alias to original identity, if possible.

set
SingletonContainer set(ObjectFactory object, string key)

* Set object factory * * Params: * object = factory for a object that is to be managed by prototype container. * key = identity of factory * Returns: * typeof(this)

terminate
Container terminate()

Destruct all managed components.

unlink
SingletonContainer unlink(string alias_)

Removes alias.

Meta