Class dijon.Injector
dijon.Injector
Defined in: dijon.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
addOutlet(targetKey, propertyName, sourceKey)
defines
propertyName as an injection point for the class mapped to targetKey to be injected with an instance
of the class mapped to sourceKey . |
|
getInstance(key)
Create (if possible) or retrieve an instance of the class mapped to
key |
|
hasMapping(whenAskedFor)
Does a rule exist to satsify such a request?
|
|
injectInto(instance)
Perform an injection into an object, satisfying all it's dependencies
|
|
instantiate(keyOrClass)
create an instance of the class mapped to
keyOrClass and fulfill it's mapped dependenciesWILL ALWAYS CREATE A NEW INSTANCE, even if keyOrClass was mapped otherwise or
even when keyOrClass was not mapped. |
|
mapClass(whenAskedFor, instantiateClass)
When asked for an instance of the class
whenAskedFor or for object whenAskedFor inject a new instance of instantiateClass . |
|
mapSingleton(whenAskedFor)
When asked for an instance of the class
whenAskedFor |
|
mapSingletonOf(whenAskedFor, useSingletonOf)
When asked for an instance of the class
whenAskedFor or object whenAskedFor inject an instance of useSingletonOf . |
|
mapValue(whenAskedFor, useValue)
When asked for an instance of the class
whenAskedFor or object whenAskedFor inject the instance useValue . |
|
removeOutlet(key, propertyName)
removes an injection point mapping for a given class mapped to
key |
|
unmap(whenAskedFor)
Remove a rule from the injector
|
Method Detail
addOutlet(targetKey, propertyName, sourceKey)
defines
propertyName
as an injection point for the class mapped to targetKey
to be injected with an instance
of the class mapped to sourceKey
.
- Parameters:
- {Class} targetKey
- the class the injection point is applied to.
- {String} propertyName
- the name of the property used as an injection point.
[!] MUST BE STRING - {Object} sourceKey
- the key to the value that will be injected
{Object}
getInstance(key)
Create (if possible) or retrieve an instance of the class mapped to
key
- Parameters:
- {Object} key
- Returns:
- {Object}
{Boolean}
hasMapping(whenAskedFor)
Does a rule exist to satsify such a request?
- Parameters:
- {Class} whenAskedFor
- Returns:
- {Boolean}
injectInto(instance)
Perform an injection into an object, satisfying all it's dependencies
- Parameters:
- {Object} instance
{Object}
instantiate(keyOrClass)
create an instance of the class mapped to
WILL ALWAYS CREATE A NEW INSTANCE, even if
keyOrClass
and fulfill it's mapped dependenciesWILL ALWAYS CREATE A NEW INSTANCE, even if
keyOrClass
was mapped otherwise or
even when keyOrClass
was not mapped.
- Parameters:
- {Class} keyOrClass
- Returns:
- {Object}
mapClass(whenAskedFor, instantiateClass)
When asked for an instance of the class
whenAskedFor
or for object whenAskedFor
inject a new instance of instantiateClass
.
- Parameters:
- {Class|Object} whenAskedFor
- {Class} instantiateClass
mapSingleton(whenAskedFor)
When asked for an instance of the class
whenAskedFor or object whenAskedFor
inject an instance of whenAskedFor.
- Parameters:
- {Class|Object} whenAskedFor
mapSingletonOf(whenAskedFor, useSingletonOf)
When asked for an instance of the class
whenAskedFor
or object whenAskedFor
inject an instance of useSingletonOf
.
- Parameters:
- {Class|Object} whenAskedFor
- {Class} useSingletonOf
mapValue(whenAskedFor, useValue)
When asked for an instance of the class
whenAskedFor
or object whenAskedFor
inject the instance useValue
.
- Parameters:
- {Class|Object} whenAskedFor
- {Object} useValue
removeOutlet(key, propertyName)
removes an injection point mapping for a given class mapped to
key
- Parameters:
- {Object} key
- {String} propertyName
- MUST BE STRING
unmap(whenAskedFor)
Remove a rule from the injector
- Parameters:
- {Class|Object} whenAskedFor