Package | com.soma.core.interfaces |
Interface | public interface ISomaInjector |
Implementors | SomaInjector |
Author: Romuald Quantin - www.soundstep.com
Resources: http://www.soundstep.com/downloads/somacore
Actionscript version: 3.0
Copyright: Mozilla Public License 1.1 (MPL 1.1) http://www.opensource.org/licenses/mozilla1.1.php
The ISomaInjector interface exposes the injection methods used by the framework.See also
Property | Defined By | ||
---|---|---|---|
applicationDomain : ApplicationDomain
ApplicationDomain in use in the injector. | ISomaInjector |
Method | Defined By | ||
---|---|---|---|
Creates a child injector. | ISomaInjector | ||
createInstance(classTarget:Class):Object
Instantiates a new instance from a given class. | ISomaInjector | ||
dispose():void
Destroys the injector elements. | ISomaInjector | ||
getInstance(classTarget:Class, name:String):Object
Retrieves or instantiates an instance of the given Class. | ISomaInjector | ||
Retrieves the injector parent if any. | ISomaInjector | ||
hasMapping(classTarget:Class, name:String):Boolean
Indicates wether a mapping rule exists for the given Class. | ISomaInjector | ||
injectInto(instance:Object):void
Performs injection into the given instance. | ISomaInjector | ||
map(whenAskFor:Class, createClass:Class, name:String):void
Rule that defines the "whenAskFor" to be injected with an instance of the "createClass" Class. | ISomaInjector | ||
mapSingleton(classTarget:Class, name:String):void
Rule that defines the "classTarget" to be injected with always the same instance. | ISomaInjector | ||
mapSingletonOf(whenAskFor:Class, useSingletonOf:Class, name:String):void
Rule that defines the "whenAskFor" (usually an interface) to be injected with the same instance "useSingletonOf". | ISomaInjector | ||
mapToInstance(whenAskFor:Class, instance:Object, name:String):void
Rule that defines the "whenAskFor" to be injected the given instance. | ISomaInjector | ||
removeMapping(classTarget:Class, name:String):void
Removes a mapping rule exists for the given Class. | ISomaInjector |
applicationDomain | property |
applicationDomain:ApplicationDomain
ApplicationDomain in use in the injector.
public function get applicationDomain():ApplicationDomain
public function set applicationDomain(value:ApplicationDomain):void
createChildInjector | () | method |
public function createChildInjector():ISomaInjector
Creates a child injector. The child injector inherits the rules of its parents.
ReturnsISomaInjector — A ISomaInjector instance.
|
createInstance | () | method |
public function createInstance(classTarget:Class):Object
Instantiates a new instance from a given class. This method will always creates a new instance, regardless of any singleton mapping.
Parameters
classTarget:Class — A Class.
|
Object — An instance of the Class target.
|
dispose | () | method |
public function dispose():void
Destroys the injector elements.
getInstance | () | method |
public function getInstance(classTarget:Class, name:String):Object
Retrieves or instantiates an instance of the given Class. This method needs a mapping rule, the instance can be a singleton or a new one.
Parameters
classTarget:Class — A Class.
| |
name:String — Injection name.
|
Object — An instance of the Class target.
|
getParentInjector | () | method |
public function getParentInjector():ISomaInjector
Retrieves the injector parent if any.
ReturnsISomaInjector — A ISomaInjector instance.
|
hasMapping | () | method |
public function hasMapping(classTarget:Class, name:String):Boolean
Indicates wether a mapping rule exists for the given Class.
Parameters
classTarget:Class — A Class.
| |
name:String — Injection name.
|
Boolean — A Boolean.
|
injectInto | () | method |
public function injectInto(instance:Object):void
Performs injection into the given instance.
Parameters
instance:Object — An instance.
|
map | () | method |
public function map(whenAskFor:Class, createClass:Class, name:String):void
Rule that defines the "whenAskFor" to be injected with an instance of the "createClass" Class.
Parameters
whenAskFor:Class — A Class.
| |
createClass:Class — A class.
| |
name:String — Injection name.
|
mapSingleton | () | method |
public function mapSingleton(classTarget:Class, name:String):void
Rule that defines the "classTarget" to be injected with always the same instance.
Parameters
classTarget:Class — A Class.
| |
name:String — Injection name.
|
mapSingletonOf | () | method |
public function mapSingletonOf(whenAskFor:Class, useSingletonOf:Class, name:String):void
Rule that defines the "whenAskFor" (usually an interface) to be injected with the same instance "useSingletonOf".
Parameters
whenAskFor:Class — A Class.
| |
useSingletonOf:Class — A class.
| |
name:String — Injection name.
|
mapToInstance | () | method |
public function mapToInstance(whenAskFor:Class, instance:Object, name:String):void
Rule that defines the "whenAskFor" to be injected the given instance.
Parameters
whenAskFor:Class — A Class.
| |
instance:Object — An instance.
| |
name:String — Injection name.
|
removeMapping | () | method |
public function removeMapping(classTarget:Class, name:String):void
Removes a mapping rule exists for the given Class.
Parameters
classTarget:Class — A Class.
| |
name:String — Injection name.
|